[英]MySQL update with a subquery
I am trying to update a specific row in a table based on another value in that table, but I can't seem to figure out how to do it: 我正在尝试根据该表中的另一个值更新表中的特定行,但似乎无法弄清楚该如何做:
UPDATE users AS a SET a.val = (SELECT value FROM users WHERE userid = 4) WHERE a.userID = 1
but I am getting the error 但我得到了错误
Lookup Error - MySQL Database Error: You can't specify target table 'a' for update in FROM clause
Any ideas what I am missing here? 有什么想法我在这里想念的吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.