求指导,如果要查出2个字段都重复的数据,该如何写?
1个字段是SELECT table_name FROM table GROUP BY table HAVING COUNT(*) > 1
如果是2个该如何写?
------解决方案--------------------select 字段1,字段2 from 表名 group by 字段1,字段2, having count(*)>1
------解决方案--------------------SQL code
select 字段1,字段2,count(1) from 表名
group by 字段1,字段2
having count(*)>1
------解决方案--------------------
select 字段1,字段2 from 表名 group by 字段1,字段2 having count(*)>1
去掉字段2后面的逗号