Created
August 17, 2023 09:30
-
-
Save oharsta/a9b2503392ccf08e7576c8ec0cef1eb7 to your computer and use it in GitHub Desktop.
Find duplicates based on multiple columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select s.id, t.* | |
from service_groups s | |
join ( | |
select short_name, service_id, count(*) as qty | |
from service_groups | |
group by short_name, service_id | |
having count(*) > 1 | |
) t on s.short_name = t.short_name and s.service_id = t.service_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment