Delete all duplicate records from a table


Remove dupe rows

Get raw version
  1. -- Add an index on the table in question that is unique for some combination of fields.
  2. -- We're ignoring the warning that this will cause some rows to be dropped.
  3. ALTER IGNORE TABLE my_table ADD UNIQUE INDEX dupidx (field_1, field_2);
  4. -- The dupes are gone, remove the index.
  5. ALTER TABLE my_table DROP INDEX dupidx;