replace

Remove duplicates from a table column in database

You have a table with a column with many duplicates and you just want to keep one of each. Make a distinct copy of the table, remove the old table and rename the new one.

CREATE TABLE temp_table as SELECT * FROM duplicate_table WHERE 1 GROUP BY duplicate_column;

DROP TABLE duplicate_table;

RENAME TABLE temp_table TO duplicate_table;

This example sumarize a value when aggregate to duplicates

Pages