Skip to content

Instantly share code, notes, and snippets.

@stefanbirkner
Created July 1, 2013 10:12
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 stefanbirkner/5899741 to your computer and use it in GitHub Desktop.
Save stefanbirkner/5899741 to your computer and use it in GitHub Desktop.
Delete duplicates in a table.
-- replace idfield, duplicatewitness and mytable with appropriate names
delete from mytable where idfield in (select max(idfield) from mytable GROUP BY duplicatewitness HAVING COUNT(*) > 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment