select field_name,
max(case when f_level='F0' THEN count else 0 end) as F0,
max(case when f_level='F1' THEN count else 0 end) as F1,
max(case when f_level='F2' THEN count else 0 end) as F2,
max(case when f_level='F3' THEN count else 0 end) as F3,
max(case when f_level='F4' THEN count else 0 end) as F4,
max(case when f_level='null' THEN count else 0 end) as e
from (
select field_name,
f_level,
count(1) as count
from tmp_weibo_plat_high_quality_user_detail
where dt='20200107' and cast(score as double)>=23 and cast(filtered_fans_num as integer)>1000
group by field_name,f_level) a
group by field_name order by field_name;
hive行转列
最新推荐文章于 2025-03-02 15:42:28 发布