MySQL 5.7错误(1093:您无法在FROM子句中指定目标表___进行更新)-常规解决方案不起作用 [英] MySQL 5.7 error (1093: You can't specify target table ___ for update in FROM clause) - usual solution not working
本文介绍了MySQL 5.7错误(1093:您无法在FROM子句中指定目标表___进行更新)-常规解决方案不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个表'employees',并且我试图将某些属性(例如薪金)设置为与表中其他值相同的值.我对这个错误的理解是,可以通过以下临时表使用临时表来避免该错误:
I have a table 'employees' and I'm trying to set some attributes (e.g. salary) to the same value as some other value in the table. My understanding of this error is that it can be avoided with the following workaround, using a temporary table:
UPDATE employees
SET salary=(SELECT salary FROM (SELECT * FROM employees WHERE employee_id= '123') AS t1)
WHERE employee_id='456';
但是,尝试此操作时,我仍然收到相同的错误代码(无法在FROM子句中指定目标表'员工'进行更新").这里还有其他问题吗?
However, I am still getting the same error code ("can't specify target table 'employees' for update in FROM clause") when I try this. Is there some other issue here?
推荐答案
查看全文