MySQL - Delete Duplicate Rows

Tuesday, October 27th, 2020 | Coding
Last Modified: 2024-11-07



In case you want to delete duplicate rows and keep the lowest id, you can use the following statement:

DELETE
c1
FROM
contacts c1 INNER JOIN contacts c2 WHERE c1.id > c2.id AND c1.email = c2.email;



Input Action Output
A collection of snippets and links that have proven useful for development and programming in ColdFusion, JavaScript, jQuery, PHP, Python, Dell, Minecraft, Apple, Mac, Windows, LINUX, Raspberry Pi, Adobe, CSS, and HTML.

©2024 Input Action Output