Finding Duplicate Records In Database

By | 2016-03-19
SELECT COL_TO_CHECK, COUNT(COL_TO_CHECK)
FROM TABLE_NAME
GROUP BY COL_TO_CHECK
HAVING COUNT(COL_TO_CHECK) > 1

If there is more than 1 column with that value it will show up like:

COL_TO_CHECK               COUNT(COL_TO_CHECK)
-------------------------------------------------------------
Value                             3
Value2                            2
Value99                           4

Leave a Reply

Your email address will not be published. Required fields are marked *