MYSQL删除表中重复值

第一句:create table <temp_table1> as select * from <your_table> where <id> in ( select max(<id>) from <yourtable> group by <segment>);

 

第二句:truncate table <your first table>;


第三句:insert into <your first table> select * from <temp_table1>;

 

一般可以另建一个字段ID,让它自动增长,唯一值,然后再用此代码,效果好。

当然还可以按照最小值提取。

原文地址:https://www.cnblogs.com/arcserver/p/2489692.html