mysql删除重复数据

delete from test1 where (id,name )in
    (select * from (
        select id,name from test1 group by id,name having (count(*)>1) ) a)
    and num not in(select * from (
        select min(num) from test1 group by id,name having (count(*)>1) ) b);
        
create table d as select * from t1;
原文地址:https://www.cnblogs.com/wangyonglong/p/7596988.html