Rollup and NVL function toghether [message #595] |
Sat, 23 February 2002 13:06 |
hshah22222
Messages: 6 Registered: February 2002
|
Junior Member |
|
|
select deptno,nvl(job,'subtotal')as job,sum(sal) as salary
from emp
group by rollup(deptno,job)
how do you write grandtotal in the last line? thanks
|
|
|
Re: Rollup and NVL function toghether [message #599 is a reply to message #595] |
Sun, 24 February 2002 14:49 |
sokeh
Messages: 77 Registered: August 2000
|
Member |
|
|
try this:
i have not had time to test it:
select decode(grouping(deptno),0,to_char(deptno),'Grand Total')Deptno,
nvl(job,'subtotal') Job, sum(sal)salary
from emp
group by rollup(deptno,job)
|
|
|