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;

原文地址:https://www.cnblogs.com/liw66/p/10116174.html