日期:2014-05-18 浏览次数:20442 次
update a set a.timeA=b.timeA from ta as a,tb as b where a.关联条件=b.关联条件 and not exists(select 1 from tb where 关联条件=b.关联条件 and time1>b.time1)
------解决方案--------------------
update A set timeA = case
when time1 is null then time2
when time2 is null then them1
when time1 < time2 then time2
else time1 end
from A
join B on A.id=B.id -- 假设A,B表以ID关联
------解决方案--------------------
update A set timeA = case when time1 is null then time2 when time2 is null then them1 when time1 < time2 then time2 else time1 end from b where A.关联关系=B.关联关系
------解决方案--------------------
update A set timeA = case when time1 is null then time2 when time2 is null then them1 when time1 < time2 then time2 else time1 end from b where A.关联关系=B.关联关系