Posted By

jdbartlett on 08/18/08


Tagged

mysql


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jamesming
wizard04


Delete Dulicate Rows in MySQL


 / Published in: SQL
 

Where bad_table is the name of the table containing duplicate rows.

  1. CREATE TEMPORARY TABLE bad_temp AS SELECT DISTINCT * FROM bad_table;
  2. DELETE FROM bad_table;
  3. INSERT INTO bad_table SELECT * FROM bad_temp;

Report this snippet  

You need to login to post a comment.