Finding Duplicates with SQL

redditech's avatarPosted by

Quite a handy query for finding duplicates in a table (setting ’email’ to the field you’re checking for duplicates and ‘users’ to the table this field is in of course)

SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )

via Finding Duplicates with SQL.

One comment

Leave a reply to Keaton Stein Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.