关联子查询Update语句更新数据

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
--方法1:
Update Table1 set c = (select from Table2 where a = Table1.a) where is null 
 
--方法2:
update  A
set  newqiantity=B.qiantity
from  A,B
where  A.bnum=B.bnum 
 
--方法3:
update
    (select A.bnum ,A.newqiantity,B.qiantity from left join on A.bnum=B.bnum) AS C
set C.newqiantity = C.qiantity
where C.bnum =XX