EMP
-------
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
THis is basically the query
SELECT count(*), to_char(hiredate,'MON-YYYY'), DEPTNO
from emp
group by to_char(hiredate,'MON-YYYY'),DEPTNO
But I need the result set in a pivot table like this:
MONTH JAN-2003 FEB-2003 MAR-2003 APR-2003 .....JAN-2004 TOTAL
DEPTNO ------- -------- ------- -------- -------- -----
10 3 0 5 4 0 12
20 1 0 0 5 6 12
30 7 8 0 0 0 15
40 0 0 0 0 1 1
------ --- --- --- --- --- ---
TOTAL 11 8 5 9 7 40
I have no idea how to do this...can anyone help me here
Oracle LazyDBA home page