Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> newbie: A Quickie for some guru out there.
I'm building report which adds up the number of requested hours per
month, but the query does not return a zero for months which have no
record. Thus...
SELECT
TO_CHAR( trunc( workdate, 'month' ), 'MON-YYYY' ) AS Month,
ROUND( SUM( requesthours ))
FROM
cst_request_table
GROUP BY
trunc( workdate, 'month' );
produces...
MONTH REQUESTHOURS
-------- ------------
JAN-2002 1 JUL-2002 1 AUG-2002 12 SEP-2002 5 OCT-2002 15
The desired result is...
MONTH REQUESTHOURS
-------- ------------
JAN-2002 1 FEB-2002 0 MAR-2002 0 APR-2002 0 MAY-2002 0 JUN-2002 0 JUL-2002 1 AUG-2002 12 SEP-2002 5 OCT-2002 15
Any neat suggestions?
thx.
Received on Mon Sep 16 2002 - 01:45:31 CDT
![]() |
![]() |