使用SQLServer中的联接更新表?我想更新表中的列,在其他表上进行连接,例如:UPDATE table1 a
INNER JOIN table2 b ON a.commonfield = b.[common field] SET a.CalculatedColumn= b.[Calculated Column]WHERE
b.[common field]= a.commonfieldAND a.BatchNO = '110'但这是在抱怨:MSG 170,15级,状态1,第2行第2行:a附近不正确的语法。这里怎么了?
3 回答
万千封印
TA贡献1891条经验 获得超3个赞
begin tran UPDATE a SET a.CalculatedColumn= b.[Calculated Column] FROM table1 a INNER JOIN table2 b ON a.commonfield = b.[common field] WHERE a.BatchNO = '110'commit tran
跃然一笑
TA贡献1826条经验 获得超6个赞
UPDATE a SET a.CalculatedColumn = b.[Calculated Column] FROM Table1 AS a INNER JOIN Table2 AS b ON a.CommonField = b.[Common Field] WHERE a.BatchNo = '110';
update tableName t set t.name = 'books new' where t.id = 1
update t set t.name = 'books new' from tableName t where t.id = 1
添加回答
举报
0/150
提交
取消