与MySQL中的Distinct相反 [英] Opposite of Distinct in MySQL
本文介绍了与MySQL中的Distinct相反的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道sql中是否存在选择不同"的对立面,以便我可以从仅重复了多次的表中获取值.
I would like to know if there is an opposite of "select distinct" in sql ,so that i can use to get values from a table of only which has repeated multiple times.
谢谢
推荐答案
select some_column, count(*)
from some_table
group by 1
having count(*) > 1;
在像mysql这样的数据库上,您甚至可以省略选择count(*)
来保留 just 列值:
On databases like mysql, you may even omit selecting count(*)
to leave just the column values:
select some_column
from some_table
group by 1
having count(*) > 1;
这篇关于与MySQL中的Distinct相反的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文