DELETE FROM table name WHERE (field 1, field 2, field 3) the IN (the SELECT field 1, field 2, field 3 FROM (SELECT field 1, field 2, field 3 the FROM table GROUP BY field 1, field 2, field 3 the HAVING COUNT (*)> 1) S1) the AND ID the NOT the IN (the SELECT min (ID) AS ID the FROM (the SELECT ID the FROM table GROUP BY field 1, field 2, field 3 HAVING COUNT (*)> 1 ) s2);
Reference https://www.cnblogs.com/XiaoMingBlingBling/p/11146375.html modify the last sub-query id is min (id) as id