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);

posted on 2020-04-26 11:29  Frank-  阅读(1675)  评论(0编辑  收藏  举报

导航