select content_tag
,count(itemLink) as videos
,sum(playednumber) as vv
,sum(commentnum) as comments
,sum(likenum) as likes
from 表名
lateral view explode(split(trim(tag),'\\$\\$')) z1 as content_tag
where dt="2020-07-20"
and content_tag!=""
group by content_tag
order by vv desc
limit 3000;
使用场景:hive,Xshell
知识点总结
1、使用count、sum等函数时必须配group by
2、order by排序,默认升序,降序加desc
3、lateral view explode的用法
4、$$分隔的时候需要分别使用2个转义符号才能正确识别