Created
February 16, 2012 12:05
-
-
Save mipmip/1844380 to your computer and use it in GitHub Desktop.
SQL: remove duplicate records
This file contains hidden or 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
CREATE TEMPORARY TABLE keepids ( | |
SELECT MIN(uid) FROM tt_address | |
GROUP BY (email) | |
); | |
DELETE FROM tt_address WHERE uid NOT IN (SELECT * FROM keepids); | |
DROP TABLE keepids; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment