Skip to content

Instantly share code, notes, and snippets.

@aslamdoctor
Created September 19, 2013 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslamdoctor/6620020 to your computer and use it in GitHub Desktop.
Save aslamdoctor/6620020 to your computer and use it in GitHub Desktop.
Delete duplicate records from MySQL Database
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