Due to a bug, I now have the possibility that certain tables have rows with duplicate data in primary key columns.
Let's say I have table T with primary key columns A, B, C and D, and non-PK columns E, F and G. In order for a row to be unique, A B C and D all must have unique values. I could have rows where A is the same, or A and B have the same values, or even A B and C. But if I have two rows where A B C and D all have the same value, that would be a problem.
Would this be the correct approach to find such an occurrence:
SELECT A, B, C, D, COUNT(*) AS 'Duplicates' FROM T
GROUP BY A, B, C, D
HAVING COUNT(*) > 1
Thanks for any assistance.