Table of contents
Open Table of contents
Delete
196. Delete Duplicate Emails
NOT IN
DELETE FROM Person
WHERE id NOT IN (
SELECT MIN(id)
FROM Person
GROUP BY email
)
SELF JOIN
DELETE FROM Person p1
USING Person p2
WHERE p1.email = p2.email
AND p1.id > p2.id