hive sql 怎么分组统计
1个回答
展开全部
select sno,type ,count(type)from table group by sno,type
这是竖的,横的下面
select sno,sum(case when type='a' then 1 else 0 end) as t_a,sum(case when type='b' then 1 else 0 end) as t_b,sum(case when type='c' then 1 else 0 end) as t_c from table group by sno
这是竖的,横的下面
select sno,sum(case when type='a' then 1 else 0 end) as t_a,sum(case when type='b' then 1 else 0 end) as t_b,sum(case when type='c' then 1 else 0 end) as t_c from table group by sno
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询