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

Posted 猪脚踏浪

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 在查询结果中进行二次查询相关的知识,希望对你有一定的参考价值。

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

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

 

以上是关于mysql 在查询结果中进行二次查询的主要内容,如果未能解决你的问题,请参考以下文章