--按salary排序,计算当前行到下面两行的salary累加值,红色部分为例,可以看到2340等于3个salary的值,物理行范围,一眼看就看出来了 SQL> select id,last_name,salary,dept_id, 2 sum(salary) over(order by salary 3 rows between current row and 2 following) 4 from s_emp; ID LAST_NAME SALARY DEPT_ID SUM(SALARY)OVER(ORDERBYSALARYR -------- ------------------------- ------------- -------- ------------------------------ 20 Newman 750.00 43 2340 19 Patel 795.00 42 2390 23 Patel 795.00 34 2445 22 Chang |
oracle中range/rows的区别
最新推荐文章于 2024-05-24 10:54:19 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)