Group by + CaseWhen 怎么实现 返回

求助
3 118

类似这样的查询

select userId

,sum(case when type= 0 then Count else 0 end) as num0

,sum(case when Type= 1 then Count else 0 end) as num1

,sum(case when Type= 2 then Count else 0 end) as num2

from usertool

group by userId


热忱回答3

版块

学习文档

新注册

发布达人

回贴达人