Remove Duplicates in SQL Using Insert
The simplest and most efficient way to remove duplicates (in this case using MySQL) is to create new table from another table, but grouping existing table by column(s) which you want to be unique.
CREATE TABLE tmp SELECT * FROM some_table GROUP BY (some_column);
Very simple, and fast – this method is far better than using distinct or doubling table with unique selection. In my case, it took 53 seconds to remove duplicates from 750k+ big table.
Hope you like it!
Share this story:
Leave a Reply