mysql 1093错误

delete from grade where id not in(select id from grade group by userid,de
gree,subject);

出现错误:
ERROR 1093 (HY000): You can't specify target table 'grade' for update in FROM clause

解决办法:
delete from grade where id not in(select id from (select * from grade) g
group by userid,degree,subject);

你可能感兴趣的:(sql,mysql)