I checked https://stackoverflow.com/a/8149330/11343720 but, I want change the condition with OR
instead of AND
.
I need get dupliate data with duplicate name or duplicate city
.
How I can do this?
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 OR s.city = t.city
So I want to do something like this SQL code below:
select s.id, s.name,s.city
from stuff s
group by s.name having count(where city OR name are identical) > 1