there are 3 steps, and therefore 3 SQL statements to removing duplicate entries / rows in mySQL.

Step one: Move unique rows to new table

CREATE TABLE new_table as
SELECT * FROM old_table WHERE 1
GROUP BY [column to remove duplicates by];


Stop two: delete old table

delete old_table

Step three: renaming new table to the names of the old one.

RENAME TABLE new_table TO old_table;





0 yorum

Post a Comment