Technical Article

Find Duplicates

,

Find duplicates in any table, and report the number of duplicates. Enter in the table name, and the field or fields
for which there should only be one row for each of that field, but you suspect are more. For example, if an employee table has more than one record for an employee
this will find any multiple instances of his emplid.

SELECT <field such as emplid> , 
<2nd field that uniquely identifies>, 
COUNT(*) - 1 AS Duplicates
FROM <tablename>
GROUP BY <field such as emplid>, <2nd field that uniquely identifies>
HAVING COUNT(*) > 1

Rate

5 (1)

You rated this post out of 5. Change rating

Share

Share

Rate

5 (1)

You rated this post out of 5. Change rating