Remove duplicate entries from MySQL table
This is a quick and easy fix to remove duplicate entries from a MySQL table.
1: Move the non duplicates entries into a temp table
CREATE TABLE new_table as SELECT * FROM wrong_table GROUP BY [column to remove duplicates by];
2: Delete the wrong table
DROP TABLE wrong_table;
3: Rename the new_table to the name of the wrong_table
RENAME TABLE new_table TO wrong_table;
And last but not least, don’t forget to fix your buggy code to stop inserting duplicates entries!