mysql 删除相同的记录

来源:互联网 发布:aofax呼叫中心软件 编辑:程序博客网 时间:2024/06/15 09:01

不能直接用delete from test where id not in (select id from test);

、、要用

drop TABLE if EXISTS temp;
CREATE TABLE temp as select min(id) as id from test GROUP BY name;
delete from test where id not in (select id from temp);

原创粉丝点击