本文主要是介绍Hive,分组后前几,Top N,记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
select * from sales_info where dt = '2019-04-26';
查询每个分类下,GMV(销售额)前三的商品明细:
select a.* FROM
(select sku_id,sku_name,category_id3,sales_count,price,sales_count*price,row_number() over(partition by category_id3 order by sales_count*price desc) as r1from sales_info where dt = '2019-04-26'
)a
where a.r1<=3
这篇关于Hive,分组后前几,Top N,记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!