Hive开窗函数的理解

1.从一个sql语句开始

     select id,sum(price) over(partition by id order by price desc) from books;    
sum作为聚合函数的时候,直接select sum(price) from boos;即可;
sum作为开窗(窗口)函数的时候,需要通过partition by指定sum怎么取值,比如partition by price,就是把和 这本书价格一样的书的数量*价格 进行返回。

猜你喜欢

转载自www.cnblogs.com/WinseterCheng/p/9168104.html