I am having table as below..
r_Id Marks
1 25
1 25
1 25
2 30
2 30
now i want a query in which sum of marks for each r_id should be calculated and result should be
r_Id MARKS Sum
1 25 75
1 25 75
1 25 75
2 30 60
2 30 60
I need to do this in oracle without using PL/SQL. Please Help. I have tried using CUBE, ROLLUP, GROUPING SETS in GROUP BY, but nothing is working.
You want to use the analytic functions for this. These are the functions that use an over clause:
select r_id, Marks, sum(Marks) over (partition by r_id)
from t;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With