Home > Database > Mysql Tutorial > mysql 同一个表不能同时进行update 和select 操作 已看过网上写法但还是有错

mysql 同一个表不能同时进行update 和select 操作 已看过网上写法但还是有错

WBOY
Release: 2016-06-06 09:33:33
Original
1152 people have browsed it

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>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template