Skip to Main Content

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 due to inactivity on Aug 15 2008
Added on Jul 18 2008
2 comments
1,327 views