How to copy a cell value from another row in the same table?
UPDATE mytable SET myvalue=(SELECT myvalue FROM mytable WHERE id=2) WHERE id=11
It gives an error message:
Table 'mytable' is specified twice, both as a target for 'UPDATE' and as a separate source for data
Thank you
UPDATE mytable SET id=11, mycol=a.mycol FROM (SELECT mycol FROM mytable WHERE id=2) a
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments