标签: sql hive hql hiveql
我想要每个键的前2个值。结果如下:
配置单元查询应该是什么。
答案 0 :(得分:0)
您可以将window function()关闭时使用OVER:
select col1,col2 from (SELECT col1, col2, ROW_NUMBER() OVER (PARTITION BY col1 ORDER BY col2 DESC) AS row_num FROM data)f WHERE f.row_num < 3 order by col1,col2