Skip to content

Instantly share code, notes, and snippets.

@sorentwo
Created March 1, 2014 22:06
Show Gist options
  • Select an option

  • Save sorentwo/9298220 to your computer and use it in GitHub Desktop.

Select an option

Save sorentwo/9298220 to your computer and use it in GitHub Desktop.
Duplicate Removal
DELETE FROM tablename WHERE id NOT IN (SELECT MAX(dup.id) FROM tablename AS dup GROUP BY dup.field1, dup.field2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment