日期:2014-05-18  浏览次数:20526 次

update修改的问题
请教下各位

A 表 B 表

a b c d e f
---------- ----------
1 2 3 1 2 5
2 3 4 2 3 7
3 a b 3 a m
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . .  
. . . . . . 写一个update 语句,当a表的a.a=b.d and a.b=b.e时更改a.c=b.f

------解决方案--------------------
SQL code
update t1 set c=t2.f from a t1 inner join b t2 on t1.a=t2.d and t1.b=t2.e

------解决方案--------------------
SQL code
update a
set a.c=b.f
from b
where a.a=b.d and a.b=b.e

------解决方案--------------------
SQL code
update a set c=b.f from a,b where a.a=b.d and a.b=b.e

------解决方案--------------------
探讨

update mm set mm.FEntrySelfS0168 = b.fbillno
from seorderentry mm inner join
(select t2.fbillno,t1.fentryid,t2.fitemid
from t_sz_wkorderentry t1,t_sz_wkorder t2 ,seorderentry t3
where t1.fid = t……