Created
May 16, 2012 00:38
-
-
Save bensie/2706330 to your computer and use it in GitHub Desktop.
Find duplicate rows in MySQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assumes you're looking to add a unique index to [:field1, :field2] and want to find duplicates to remove/fix them | |
SELECT id, field1, field2, count(*) FROM table GROUP BY field1, field2 HAVING count(*) > 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment