MySQL删除重复数据

#1.创建临时表

CREATE TEMPORARY TABLE tmp_t
select id from table where id  not in (select max(id) from table group by mc,dz);

#2.删除重复记录

delete from table where id in (select id from tmp_t);

#3.删除临时表

DROP TEMPORARY TABLE IF EXISTS tmp_t;

posted @ 2018-12-13 20:23  liw66  阅读(136)  评论(0)    收藏  举报