mysql 表中重复数据过滤

表结构:

 操作语句:

SET SQL_SAFE_UPDATES = 0;

eg1:delete from ybtest.student where id not in( select minId from ( select min(id) as minid from ybtest.student group by name,sex,subject,score ) as T ) ;
eg2:delete from ybtest.student where id in ( select *from ( select max(id) as maxid from ybtest.student group by name,sex,subject,score having count(*)>1) as a);

原文地址:https://www.cnblogs.com/wu-peng/p/12778354.html