讓我們假設table1爲a,table2爲b,它們都是不同的結構,但是有相同的字段叫branch,我想插入table2.branch
到table1.branch
。SQL更新,如何向table1插入table2的值
我已經嘗試過這樣的:
update a
set a.branch = b.branch
from table1 a
inner join table2 b
on a.table1id = b.table2id
where (b.asd = '1' or b.asd = '3')
and b.branch <> a.branch
錯誤消息 「列資格賽或表B中未定義」。
這
update table1 a join table2 b on a.id=b.id
set a.branch = b.branch
where a.something <> b.something
它彈出column b not specified
我曾經嘗試都,但沒有人能夠做到。有沒有人有建議如何更新這個SQL?
能否請你澄清你的意思是:'這是彈出「B列未指定」' – PKirby
消息錯誤是 – ray
你試過我下面提供的腳本? – PKirby