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

mysql去重

时间:2016-05-25 14:41:17      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:

select a.id,a.ssmz,(select count(ssmz) from shop_tourist_key b where b.ssmz=a.ssmz) as count
             from shop_tourist_key a WHERE a.ssmz is not null group by a.ssmz LIMIT 0,3;

 

select a.id,a.ssmz,(select count(ssmz) from shop_tourist_key b where b.ssmz=a.ssmz) as count
             from shop_tourist_key a where ISNULL(a.ssmz)=false group by a.ssmz order by count DESC
            LIMIT 0,3;

select a.id,a.ssmz,(select count(ssmz) from shop_tourist_key b where b.ssmz=a.ssmz) as count,
 count(distinct a.ssmz)  from shop_tourist_key a group by a.ssmz LIMIT 0,3 ;

 

mysql去重

标签:

原文地址:http://www.cnblogs.com/1246447850qqcom/p/5526726.html

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