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;

 

posted @ 2017-09-26 15:22  依然是等待  阅读(164)  评论(0编辑  收藏  举报