mysql 删除和修改的时候,where 条件中使用原table报错的问题

来源:互联网 发布:81端口活跃ip段2017年 编辑:程序博客网 时间:2024/04/30 08:51

updae table  a set level =2 where super_code in (select code from table where level=1)

报错You can't specify target table 'A' for update in FROM clause

 

修改为

updae table  a set level =2 where super_code in (select code from (select * from  table) b where level=1)

即可