Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

sum of current row and remaining rows

mbb774Apr 4 2013 — edited Apr 4 2013
Hi Experts,

I have a requirement to pull the data like below.

ename salary expected_salary
ravi 10 250
kiran 20 240
uday 30 220
joe 70 190
anil 120 120

can you please help me.

i wrote a query like below
select ename, sal, sum(sal) over (ORDER BY sal desc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) expected_sal
from emp;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2013
Added on Apr 4 2013
8 comments
1,254 views