不能這樣嗎?
update tableA
set field1=B.field1,field2=B.field2
from tableA,tableB B where tableA.ID=tableB.ID
update tableA
set field1=B.field1,field2=B.field2
from tableA,tableB B where tableA.ID=tableB.ID
那可以先組合SQL 再用exec執行我是這樣想的,不知對你有沒有幫助
========================
回复人: wxxzf(小风) ( )
不能這樣嗎?
update tableA
set field1=B.field1,field2=B.field2
from tableA,tableB B where tableA.ID=tableB.ID
===============================
這個返回值不正確,行不通
B中的ID不是唯一的
應該怎么搞呢。。
from b
group by id
having count(id) > 1
这条语句就可以找出所有重复的id加以修改后再重新更新