【超难 高手指点】如何用SQL查询语句查出重复内容

来源:百度知道 编辑:UC知道 时间:2024/05/31 14:37:55
一个表 两个字段
查出第1个字段中重复的内容
而且要在第2个字段中的内容也是重复的
例如:
一条数据
第1个字段中的值为:1
第2个字段中的值为:9
另外一条数据
第1个字段中的值为:1
第2个字段中的值为:9
的重复关系
也就是双重重复

这有什么难的,还叫超难

select * from 表 a,( select 字段1,字段2,count(*) from 表 group by 字段1,字段2 having count(*) > 1 ) b
where a.字段1 = b.字段1 and a.字段2 = b.字段2

select * from tablea a, tableb b where a.字段=b.比较字段 and a.字段2=b.比较字段2

select count(id),id from table group by fromid having count(name1)>1 and havingcount(name2)>1;