有没有办法在使用查询获取hive中的预期输出?
select (CASE WHEN visit=1 THEN 'ONE' WHEN visit=2 THEN 'TWO' ELSE 'ABOVE_TWO' END),
count(visit) from sample_tbl
group by (CASE WHEN visit=1 THEN 'ONE' WHEN visit=2 THEN 'TWO' ELSE 'ABOVE_TWO' END);
访问
1
1
3
3
ONE 2
ABOVE_TWO 2
ONE 2
TWO 0
ABOVE_TWO 2
答案 0 :(得分:0)
我不是蜂巢专家,但您可以尝试:
id_jenis_surat
答案 1 :(得分:0)
select case visit when 1 then 'ONE' when 2 then 'TWO' else 'ABOVE_TWO' end as visit,count(visit) from sample_tbl GROUP BY visit;