--两个表怎么关联? 写法的思路是:update b set f2=case a.f1 when 14 then a.f2 else b.f2 end
            ,f3=case a.f1 when 24 then a.f2 else b.f3 end
from b表 b join a表 a on a.关联字段=b.关联字段

解决方案 »

  1.   


    insert into table_b 
    select f1,x=(case f1 when '14' then f2 when '24' then '' end),y==(case f1 when '14' then '' when '24' then f2 end) from table_a
      

  2.   

    --如果是插入,用insert 表b(f1,f2,f3)
    select f1,case f1 when 14 then f2 end,case f1 when 24 then f2 end
      

  3.   

    哦,我刚才写错了
    insert into table_b 
    select f1,(case f1 when '14' then f2 when '24' then '' end),(case f1 when '14' then '' when '24' then f2 end) from table_a:)
    这回好了
      

  4.   

    谢谢大家了,试了一下
    insert 表b(f1,f2,f3)
    select f1,case f1 when 14 then f2 end,case f1 when 24 then f2 end
    可以实现了