Created
February 20, 2019 17:27
-
-
Save garsaud/0a8c52a7b08eff91e261ba9e45beb693 to your computer and use it in GitHub Desktop.
SQL: Remove duplicates except one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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