mysql 在查询结果中进行二次查询

来源:互联网 发布:多伦多大学知乎 编辑:程序博客网 时间:2024/05/29 04:19

第一次查询:查询身份证编号和出现次数

select cardid,count(cardid) as total from p_person_info group by cardid

在第一次查询结果进行二次查询:查询身份证出现次数大于1以上

select cardid from (select cardid,count(cardid) as total from p_person_info group by cardid) temp where temp.total>1

 

阅读全文
0 0
原创粉丝点击