Answers for "You can't specify target table 'Person' for update in FROM clause"

SQL
1

You can't specify target table 'Person' for update in FROM clause

# WRONG 
UPDATE table SET a=value WHERE x IN
    (SELECT x FROM table WHERE condition);

# CORRECT (Add one more outer level of select query)
UPDATE table SET a=value WHERE x IN
    (SELECT * FROM (SELECT x FROM table WHERE condition) as t)
Posted by: Guest on April-25-2022

Code answers related to "You can't specify target table 'Person' for update in FROM clause"

Code answers related to "SQL"

Browse Popular Code Answers by Language