Created
August 21, 2012 07:08
-
-
Save stajnert/3412980 to your computer and use it in GitHub Desktop.
Get duplicates from 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
Single records: | |
SELECT column, COUNT(*) AS c | |
FROM table | |
GROUP BY column | |
HAVING COUNT(c) > 1 | |
All records: | |
SELECT * | |
FROM table | |
WHERE column IN ( | |
SELECT column | |
FROM table | |
GROUP BY column | |
HAVING count(column) > 1 | |
) | |
ORDER BY column |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment