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 -> Re: newbie: A Quickie for some guru out there.

Re: newbie: A Quickie for some guru out there.

From: Candido Dessanti <termy_at_blunet.it>
Date: Mon, 16 Sep 2002 10:20:08 +0200
Message-ID: <3D859438.80109@blunet.it>

Make a dummy table containing just a record for each montth with requesthours set to 0

create table dummytable
(workdate date,
  requesthours number);

insert into dummytable
values (to_date('01-2001','MM-YYYY');
insert into dummytable
values (to_date('02-2001','MM-YYYY');
insert into dummytable
values (to_date('03-2001','MM-YYYY');
insert into dummytable
...
values (to_date('11-2001','MM-YYYY');
insert into dummytable
values (to_date('12-2001','MM-YYYY');

and so on, then change your query

> SELECT
> TO_CHAR( trunc( workdate, 'month' ), 'MON-YYYY' ) AS Month,
> ROUND( SUM( requesthours ))
> FROM

      (select * from cst_request_table
       union all
        select * from dummytable)

> GROUP BY
> trunc( workdate, 'month' );

this would works.

btw: you can do the same even with a function instead of dummytable. if you are interested tell me Received on Mon Sep 16 2002 - 03:20:08 CDT

Original text of this message

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