1,216
社区成员
发帖
与我相关
我的任务
分享
select cus,
sum(case when mat='猪肉' then money else 0 end) as '猪肉',
sum(case when mat='牛肉' then money else 0 end) as '牛肉'
from tb
group by cus
select cus,
sum(case when mat='猪肉' then money else 0) as '猪肉',
sum(case when mat='牛肉' then money else 0) as '牛肉'
from tb
group by cus