数据库group by语句select * from hb_student_info where card_id in(select card_id from hb_student_info group by card_id having count(card_id)>1)我知道这句的功能是查找出card_id相同的纪录 具体是怎么实现功能的,count函数大于1是什么意思?
问题描述:
数据库group by语句
select * from hb_student_info where card_id in(select card_id from hb_student_info group by card_id having count(card_id)>1)
我知道这句的功能是查找出card_id相同的纪录 具体是怎么实现功能的,count函数大于1是什么意思?
答
select card_id from hb_student_info group by card_id having count(card_id)>1group by 是按照card_id分组,配合having做条件筛选比如hb_student_info中数据如下:card_id 栏位1 栏位2 001 1 2001 2 2001 3 4002 4...