MySQL 中发生 You can't specify target table '表名' for update in FROM clause

好像只有在 mysql 中有此限制,解决方法就是不要在 update 的 where 语句中直接使用 select 子查询,再嵌套一层就可以了。。。

例如:update tablename set xx=0 where id in (select id from (select id from anothertable) as t)

posted @ 2020-04-16 15:15  不是豆豆  阅读(174)  评论(0编辑  收藏  举报
友情链接:迷途