Created
September 19, 2013 07:16
-
-
Save aslamdoctor/6620020 to your computer and use it in GitHub Desktop.
Delete duplicate records from MySQL Database
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
DELETE FROM table1 | |
USING table1, table1 AS vtable | |
WHERE ( | |
table1.ID > vtable.ID | |
) | |
AND ( | |
table1.field1 = vtable.field1 | |
) | |
AND ( | |
table1.field2 = vtable.field2 | |
) | |
AND ( | |
table1.field3 = vtable.field3 | |
) | |
AND ( | |
table1.field4 = vtable.field4 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment