MySQL Forums
Forum List  »  General

You can't specify target table for update in FROM clause
Posted by: Douglass Davis
Date: June 22, 2014 02:15AM

How can I do the following in a single query:

UPDATE acx_project_users u_invited
SET user_id = 38
WHERE user_id = 5514
AND NOT EXISTS (
SELECT 1 FROM
acx_project_users u_existing
WHERE u_existing.user_id = u_invited.user_id
AND u_existing.project_id = u_invited.project_id
)

The above query gives me an error of

Error Code: 1093. You can't specify target table 'u_invited' for update in FROM clause

Basically all I want to do is change from one user id to another, but not if there is already a row with that user id and project id

Options: ReplyQuote


Subject
Written By
Posted
You can't specify target table for update in FROM clause
June 22, 2014 02:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.