假设一个表中有1000条记录的多列,如何在整个表中找到重复记录?

时间:2017-03-21 11:11:02

标签: mysql sql oracle duplicates

假设一个表中有1000条记录的多列,如何在整个表中找到重复记录?

请帮忙。

1 个答案:

答案 0 :(得分:0)

重复的ID:

select s.id, t.* 
from [stuff] s
join (
    select name, city, count(*) as qty
    from [stuff]
    group by name, city
    having count(*) > 1
) t on s.name = t.name and s.city = t.city     

答案也发布在此主题中:How do I find duplicates across multiple columns?