17,377
社区成员
发帖
与我相关
我的任务
分享
select cpmc(产品名称),
sum(case when dwbh='001'then sl else 0 end) part1,
sum(case when dwbh='002'then sl else 0 end) part2,
sum(case when dwbh='003'then sl else 0 end) part3
from 表2 group by cpmc
select a.dwmc cpmc,
max(decode(jldw,'千克'),sl,0) dwmc1,
max(decode(jldw,'吨'),sl*1000,0) dwmc2,
max(decode(jldw,'克'),sl/1000,0) dwmc3,
from a,b
where a.bh=b.dwbh
group by a.dwmc