Skip to content

Instantly share code, notes, and snippets.

@garsaud
Created February 20, 2019 17:27
Show Gist options
  • Save garsaud/0a8c52a7b08eff91e261ba9e45beb693 to your computer and use it in GitHub Desktop.
Save garsaud/0a8c52a7b08eff91e261ba9e45beb693 to your computer and use it in GitHub Desktop.
SQL: Remove duplicates except one
delete t1 from book t1
inner join book t2
where t1.id > t2.id
and t1.title = t2.title
and t1.user_id = t2.user_id
and t1.category_id = t2.category_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment