Posted By

bluecap on 10/15/12


Tagged

mysqlduplicatedelete


Versions (?)

Delete duplicate records in MySQL database


 / Published in: MySQL
 

Compare a table against itself to remove records where column value(s) are identical.

  1. DELETE FROM table_name USING table_name, table_name AS vtable
  2. WHERE (NOT table_name.id = vtable.id)
  3. AND (table_name.column1 = vtable.column1)
  4. AND (table_name.column2 = vtable.column2)

Report this snippet  

You need to login to post a comment.