Skip to content

Instantly share code, notes, and snippets.

@AlexanderMike
Created May 4, 2016 17:35
Show Gist options
  • Select an option

  • Save AlexanderMike/578c95cbd2f39d00fd7f7a83f157cb99 to your computer and use it in GitHub Desktop.

Select an option

Save AlexanderMike/578c95cbd2f39d00fd7f7a83f157cb99 to your computer and use it in GitHub Desktop.
Here's a handy query for finding duplicates in a table. Suppose you want to find all email addresses in a table that exist more than once:
http://www.petefreitag.com/item/169.cfm
SELECT email,
COUNT(email) AS NumOccurrences
FROM users
GROUP BY email
HAVING ( COUNT(email) > 1 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment