赞
踩
select city,year,taxes, sum(money) over() as sample1,--所有行相加 sum(money) over(partition by city) as sample2,--按city分组,组内数据相加 sum(money) over(partition by city order by year) as sample3,--按city分组,组内数据累加 sum(money) over(partition by city order by year rows between UNBOUNDED PRECEDING and current row ) as sample4 ,--和sample3一样,由起点到当前行的聚合 sum(money) over(partition by city order by year rows between 1 PRECEDING and current row) as sample5, --当前行和前面一行做聚合 sum(money) over(partition by city order by year rows between 1 PRECEDING and 1 FOLLOWING ) as sample6,--当前行和前边一行及后面一行 sum(money) over(partition by city order by year rows between current row and UNBOUNDED FOLLOWING ) as sample7 --当前行及后面所有行 from business;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。