calculate subtotal
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,