I want to run the following sql command:
ALTER TABLE `my_table` ADD UNIQUE ( `ref_id` , `type` );
The problem is that some of the data in the table would make this invalid, therefore altering the table fails.
Is there a clever way in MySQL to delete the duplicate rows?
if you don’t care which row gets deleted, use IGNORE: