select code from table a where exists ( select code as a from table where a.code = code group by code having count(*) > 1) order by code
你的表只有一个字段吗? 还是只要这个字段的内容相同就算重复数据?第一种方法: select count(*) repeat_nums,name from YOUR_TABLE_NAME group by code having count(*)>1 第二种方法:(输入你需要的结果,表有个主键id)select code from YOUR_TABLE_NAMEwhere id in ( select id from YOUR_TABLE_NAME group by codehaving(count(id))>1 )
select * from table_name t1 where 2<=(select count(code) from table_name t2 where(t1.code=t2.code));
select code from table where code in (select code from table group by code having count(code)>1)
select code as a from table where a.code = code group by code having count(*) > 1) order by code
还是只要这个字段的内容相同就算重复数据?第一种方法:
select count(*) repeat_nums,name from YOUR_TABLE_NAME group by code having count(*)>1
第二种方法:(输入你需要的结果,表有个主键id)select code from YOUR_TABLE_NAMEwhere id in (
select id from YOUR_TABLE_NAME
group by codehaving(count(id))>1
)
where code in (select code from table group by code having count(code)>1)