您的位置:首页 > 数据库 > MySQL

mysql去重

2016-05-25 13:47 435 查看
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 ;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: