• Finding Duplicate Fields in a Database Table

    Occasionally it is necessary to find duplicate fields within a database table.  The following query can be used to accomplish this easily.
    SELECT *
    FROM 'table'
    WHERE ('item' IN (SELECT 'item'
    FROM 'table'
    GROUP BY 'item'
    HAVING COUNT(*) > 1))
    ORDER BY 'item'

    This will list all rows in the desired ‘table’ where the given field (‘item’) is duplicated. This is a great query to use if you want to find duplicate email addresses in a database, or any other field that may be duplicated.





    Share

    Leave a reply