问题:
I want to update a column in a table making a join on other table eg: 我想更新在其他表上进行联接的表中的列,例如:
UPDATE table1 a
INNER JOIN table2 b ON a.commonfield = b.[common field]
SET a.CalculatedColumn= b.[Calculated Column]
WHERE
b.[common field]= a.commonfield
AND a.BatchNO = '110'
But it is complaining : 但它在抱怨:
Msg 170, Level 15, State 1, Line 2 消息170,第15级,州1,第2行
Line 2: Incorrect syntax near 'a'. 第2行:“ a”附近的语法不正确。
What is wrong here? 怎么了
解决方案:
参考一: https://stackoom.com/question/6jIR/在SQL-Server中使用JOIN更新表参考二: https://oldbug.net/q/6jIR/Update-a-table-using-JOIN-in-SQL-Server
来源:oschina
链接:https://my.oschina.net/u/4432649/blog/4327051