我正在通过子查询更新表列...但子查询恰好是无效语法的插入表达式。
那么如何做到这一点:
UPDATE table
SET column = (
INSERT otherTable (otherColumn)
OUTPUT inserted.ID
VALUES ('foo')
)
Run Code Online (Sandbox Code Playgroud)
这是从功能的角度来看?等于有效查询:
UPDATE table
SET column = (
Select ot.ID
From otherTable ot
where ot.otherColumn = table.anotherOne
)
Run Code Online (Sandbox Code Playgroud)