mysql去重

Posted 小安妮的熊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql去重相关的知识,希望对你有一定的参考价值。

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去重的主要内容,如果未能解决你的问题,请参考以下文章

链表Linked List注意事项

SQL快速入门

SQL快速入门

SQL快速入门

Raft客户端实现要点

mysql 对某几个字段去重