您的位置:首页 > 数据库 > MySQL

mysql 删除相同的记录

2012-04-12 11:49 197 查看
不能直接用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);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  mysql table delete