How To Delete Duplicate Rows In Mysql

A) Delete duplicate rows using DELETE JOIN statement

MySQL provides you with the DELETE JOIN statement that allows you to remove duplicate rows quickly.

The following statement deletes duplicate rows and keeps the highest id:

SELECT * FROM products mto WHERE EXISTS ( SELECT 1 FROM products mti WHERE mti.name = mto.name ORDER BY `mto`.`name` ASC LIMIT 1, 1 ) ORDER BY `thumbnail_img` ASC

 


Tags:



Related Posts


Comments (0)

Leave a Comment

Type the above code here