mysql 同一个表不能同时进行update 和select 操作 已看过网上写法但还是有错
程序员文章站
2022-06-17 12:13:10
...
selectmysql
mysql 版本 5.7.9
原来的代码进行的操作
UPDATE message_list SET Status
= 1 WHERE RecID IN (SELECT RecID FROM message_list );
根据网上 添加一个中间表后 还是不能进行update 操作
PDATE message_list SET Status
= 1 WHERE RecID IN (SELECT a.RecID FROM (SELECT c.* FROM message_list c) a);
下面是错误信息
mysql> UPDATE message_list SET Status
= 1 WHERE RecID IN (SELECT a.RecID FROM (SELECT c.* FROM message_list c) a);
1093 - You can't specify target table 'message_list' for update in FROM clause
mysql>