hive group by 组内排序,取top(n)
hive group by 组内排序,取top(n)
select * from (
select col1,col2,col3,row_num() over (partition by id order by col3 DESC) rank
) a
where a.rank <= n
介绍:
使用row_number()函数,其中:
partition by: 根据id分组.
o...
原创
2020-02-19 10:22:49 ·
2436 阅读 ·
0 评论