2021-09-23

Unable update table where clause in same sub table.

 




https://stackoverflow.com/a/43610081




If you can't do

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

because it is the same table, you can trick and do :

UPDATE table SET a=value WHERE x IN
    (SELECT * FROM (SELECT x FROM table WHERE condition) as t)

[update or delete or whatever]




No comments:

Post a Comment