Delivering Measurable Online Success

MySql Delete Duplicates

September 10, 2009 – 10:09 pm

We all must have faced to delete the duplicate entries in a table.
Here’s the simple solution to that. :)

The scenario is:
The table has 3 columns, A, B, and C. Column A is unique for all rows
but the columns B and C can be duplicated across rows. Now if you need
to remove the rows where B and C are duplicated.

DELETE
FROM daTable
WHERE a NOT IN
( SELECT MIN(a)
FROM daTable
GROUP
BY b,c )

  1. One Response to “MySql Delete Duplicates”

  2. useful query :)

    By Ashutosh on Nov 5, 2009

Post a Comment

*Please fill correct value in the text box given below.