第1个回答 推荐于2018-05-11
select id, name, memo
from A
where id in (select id from A group by id having count(1) >= 2)本回答被提问者和网友采纳
第2个回答 2012-02-22
select count(*),id from 表名 group by id having count(*)>1
第3个回答 2012-02-22
select id,count(1) as num from table where num>1 group by id
第4个回答 2012-02-22
select id,count(*) from A group by A.id havinig count(*)>1;
第5个回答 2018-05-11
我们假如在goods表中id是唯一的,其中name可能会相同,现在要查出name存在重复的所有条目,sql可以这样写,可能理解不同,仅供参考
select id,name from goods WHERE name in ( SELECT name FROM goods GROUP BY name HAVING COUNT(name) > 1)