Skip to content

Instantly share code, notes, and snippets.

@otkrsk
Last active December 14, 2015 05:39
Show Gist options
  • Save otkrsk/5036674 to your computer and use it in GitHub Desktop.
Save otkrsk/5036674 to your computer and use it in GitHub Desktop.
Query to check for Duplicates in a MySQL database.
SELECT * FROM `table_name`
WHERE `record_name` IN (
SELECT `record_name`
FROM `table_name`
GROUP BY `record_name`
HAVING count(`record_name`) > 1
)
ORDER BY `record_name`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment