I’m looking to find a way to search a table for duplicate values and return those duplicates (or even just one of the set of duplicates) as the result set.
For instance, let’s say I have these data:
uid | semi-unique id 1 | 12345 2 | 21345 3 | 54321 4 | 41235 5 | 12345 6 | 21345
I need to return either:
12345 12345 21345 21345
Or:
12345 21345
I’ve tried googling around and keep coming up short. Any help please?
To get each row, you can use window functions:
To get just one instance, try this:
The advantage of this approach is that you get all the columns, instead of just the id (if that helps).