DELETE JOIN
statementMySQL 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