DELETE FROM CONTACTS WHERE ID NOT IN (SELECT * FROM (SELECT max(ID) FROM CONTACTS GROUP BY EMAIL) t); -- ⇓ Test it ⇓ (Fiddle source link)