mysql删除重复数据方法

create table tmp SELECT * from lhb t where t.id not in (select max(id) from lhb group by code,date,reason);

delete from lhb where id in(select id from tmp);

drop table tmp;

mysql无法进行子查询删除,使用新建一个临时表,删除跟临时表里面不一样的数据,然后再删除临时表

posted on 2017-03-23 17:01  靖儿  阅读(268)  评论(0编辑  收藏  举报

导航