Delete duplicate records in MySQL database

/ Published in: MySQL
Save to your folder(s)

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

Copy this code and paste it in your HTML
  1. DELETE FROM table_name USING table_name, table_name AS vtable
  2. WHERE (NOT =
  3. AND (table_name.column1 = vtable.column1)
  4. AND (table_name.column2 = vtable.column2)

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.