日期:2014-05-16 浏览次数:20908 次
create table B(id,type1_value,type2_value) as select id,type,value from A;
------解决方案--------------------
insert into b
select id,
sum(if(type=1,value,0)) as type1_value,
sum(if(type=2,value,0)) as type2_value
from A
group by id