Skip to content

Instantly share code, notes, and snippets.

@amitchhajer
Created July 20, 2013 14:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitchhajer/6045247 to your computer and use it in GitHub Desktop.
Save amitchhajer/6045247 to your computer and use it in GitHub Desktop.
Delete duplicate records from database leaving one of them.
delete from my_table mt1, my_table mt2 where mt1.fieldX = mt2.fieldX and mt1.fieldY = mt2.fieldY and mt1.primary_key > mt2.primary_key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment