Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> newbie: A Quickie for some guru out there.

newbie: A Quickie for some guru out there.

From: John <google_at_johnmee.com>
Date: 15 Sep 2002 23:45:31 -0700
Message-ID: <feaafaee.0209152245.74090477@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US