DECODE Formatting [message #4736] |
Fri, 10 January 2003 09:41 |
CreativePresence
Messages: 73 Registered: December 2002
|
Member |
|
|
I have the below DECODE statement...
Break on Grade on DEPTNO
Compute Num Label 'TOTALS: ' of total on DEPTNO
Select Grade,
SUM (DECODE (DEPTNO, '10', 1, 0)) "DEPT 10",
SUM (DECODE (DEPTNO, '20', 1, 0)) "DEPT 20",
SUM (DECODE (DEPTNO, '30', 1, 0)) "DEPT 30",
SUM (DECODE (DEPTNO, '40', 1, 0)) "DEPT 40",
Count(1) "TOTAL DEPTS"
FROM SalGrade Sal, EMP Emp
Where Emp.Sal Between Sal.LoSal AND Sal.HiSal
Group by Grade
/
That displays the below report...
GRADE DEPT 10 DEPT 20 DEPT 30 DEPT 40 TOTAL DEPTS
----- ------- ------- ------- ------- -----------
1 0 2 1 0 3
2 1 0 2 0 3
3 0 0 2 0 2
4 1 3 1 0 5
5 1 0 0 0 1
But how can i get the numerical values to position on the left of the column. Also get the heading totals to cover 2 rows, i.e.
GRADE DEPT DEPT DEPT DEPT TOTAL
10 20 30 40 GRADES
--------------------------------------------
1 0 2 1 0 3
2 1 0 2 0 3
3 0 0 2 0 2
4 1 3 1 0 5
5 1 0 0 0 1
Thanks in advance.
|
|
|
|