Created
January 8, 2018 20:48
-
-
Save toledorobia/42337e9d25e14b49f2e92159ca91fe3b to your computer and use it in GitHub Desktop.
MYSQL - Remove duplicate rows
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
-- The greater ID: | |
DELETE n1 FROM names n1, names n2 WHERE n1.id > n2.id AND n1.name = n2.name | |
--The lower ID: | |
DELETE n1 FROM names n1, names n2 WHERE n1.id < n2.id AND n1.name = n2.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment