Last active
July 26, 2021 11:48
-
-
Save p0vidl0/810d63a7e4445d9f2953ab8d20692a21 to your computer and use it in GitHub Desktop.
Delete all duplicate rows based on the email field
This file contains hidden or 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 c1 FROM `clients` c1, `clients` c2 WHERE c1.`id` < c2.`id` AND c1.`email` = c2.`email`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful before creating unique index for field
email
. Leaves one row of duplicates with greatest id.