georgethebastard
asked on
Nested decode
I am trying to get this result from oracle 9i:
Job Dept10 Dept20 Dept30 Total
ANALYST 8000 6000
CLERK 1300 1900 950 4150
MANAGER 2450 2975 2850 8275
PRESIDENT 5000 5000
I saw an example using nested decodes that looked someting like this, but I can't seem to put it together. Thanks in advance for looking.
Job Dept10 Dept20 Dept30 Total
ANALYST 8000 6000
CLERK 1300 1900 950 4150
MANAGER 2450 2975 2850 8275
PRESIDENT 5000 5000
I saw an example using nested decodes that looked someting like this, but I can't seem to put it together. Thanks in advance for looking.
ASKER
Yes!
Thank You
I appreciate this very much.
Thank You
I appreciate this very much.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select job, sum(decode(dept,10,sal,0))
sum(decode(dept,20,sal,0))
sum(decode(dept,30,sal,0))
from emp
group by job