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';
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?
The issue is a functional change in mysql 5.7,scroll towards the end
Either use the JOIN or force the otimizer to behave like in the previous version with: