select 国家,sum(case when 物品类型='A' then 数量 else 0 end ) A的总数量, sum(case when 物品类型='B' then 数量 else 0 end ) B的总数量, sum(case when 物品类型='C' then 数量 else 0 end ) C的总数量 from 表A group by 国家
select 国家, sum(case 物品类型 when 'A' then 数量 else 0 end ) A的总数量, sum(case 物品类型 when 'B' then 数量 else 0 end ) B的总数量, sum(case 物品类型 when 'C' then 数量 else 0 end ) C的总数量 from 表A group by 国家
select 国家, sum(decode(物品类型,'A',数量,0) A的总数量, sum(decode(物品类型,'B',数量,0) B的总数量, sum(decode(物品类型,'C',数量,0) C的总数量 from 表A group by 国家
sum(case when 物品类型='B' then 数量 else 0 end ) B的总数量,
sum(case when 物品类型='C' then 数量 else 0 end ) C的总数量
from 表A
group by 国家
sum(case 物品类型 when 'A' then 数量 else 0 end ) A的总数量,
sum(case 物品类型 when 'B' then 数量 else 0 end ) B的总数量,
sum(case 物品类型 when 'C' then 数量 else 0 end ) C的总数量
from 表A
group by 国家
sum(decode(物品类型,'A',数量,0) A的总数量,
sum(decode(物品类型,'B',数量,0) B的总数量,
sum(decode(物品类型,'C',数量,0) C的总数量
from 表A
group by 国家