MySQL添加唯一索引前去除重复数据

delete from YOUR_TABLE where id not in (select id from (select max(id) as id from YOUR_TABLE group by UNIQUE_FIELD) as b);

 

Leave a Reply

Your email address will not be published.