码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2017-12-19 12:41:01      阅读:471      评论:0      收藏:0      [点我收藏+]

标签:person   bsp   gpo   二次   font   where   nbsp   span   sel   

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

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 在查询结果中进行二次查询

标签:person   bsp   gpo   二次   font   where   nbsp   span   sel   

原文地址:http://www.cnblogs.com/zsg88/p/8063784.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!