如何从同一个表中的另一行复制单元格值?
UPDATE mytable SET myvalue=(SELECT myvalue FROM mytable WHERE id=2) WHERE id=11
它会显示错误消息:
Table 'mytable' is specified twice, both as a target for 'UPDATE' and as a separate source for data
谢谢
答案 0 :(得分:1)
UPDATE mytable SET id=11, mycol=a.mycol FROM (SELECT mycol FROM mytable WHERE id=2) a