--两个表怎么关联? 写法的思路是: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.关联字段
,f3=case a.f1 when 24 then a.f2 else b.f3 end
from b表 b join a表 a on a.关联字段=b.关联字段
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
select f1,case f1 when 14 then f2 end,case f1 when 24 then f2 end
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:)
这回好了
insert 表b(f1,f2,f3)
select f1,case f1 when 14 then f2 end,case f1 when 24 then f2 end
可以实现了