Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
msa969
Starting Member
13 Posts |
Posted - 2001-10-29 : 11:50:40
|
| This query calculates all column apart from total,i.e.@p5q12ii.sqlJOB Dept 10 Deptno 30 Dept 30 Total--------- ---------- ---------- ---------- ----------ANALYST 6000CLERK 1300 1900 950MANAGER 2450 2975 2850PRESIDENT 5000SALESMAN 5600This is the codeselect job,sum(decode(deptno, 10,sal)) "Dept 10", sum(decode(deptno,20,sal))"Deptno 30", sum(decode(deptno,30,sal)) "Dept 30",sum(decode(deptno,10,sal)+decode(deptno,20,sal)+decode(deptno,30,sal)) "Total" from emp group by job;I am stumped why it does'nt work.Please help. |
|
|
|
|
|
|
|