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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

calculate subtotal

bamboo123Jul 18 2008 — edited Jul 18 2008
HI, I have

ID Grade Score
2 B 3
2 A 2
2 B 1
1 A 3
1 A 3

I want to display just the subtotal and keep everything the same like this:

ID Grade Score
2 B 3
2 A 2
2 B 1
Subtotal 6
1 A 3
1 A 3
subtotal 6

I tried this but it didn't display the way I want it.
select id,case grouping(id)
when 0 then grade else 'SubTotal'
end grade,
sum(score) score
from table
group by rollup(id,grade)

Thanks,

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 15 2008
Added on Jul 18 2008
2 comments
1,502 views