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: Help with sql-query

Re: Help with sql-query

From: Matt T <puskas.duck_at_gmail.com>
Date: Thu, 21 Jun 2007 15:02:29 -0000
Message-ID: <1182438149.215172.103920@o61g2000hsh.googlegroups.com>


Ugly code alert - and wouldn't want to debug that.

Surely the elegant (well designed!) solution is a calendar_dates table.....

SELECT * FROM test_tab

1	21/06/2007	24/06/2007
2	23/06/2007	30/06/2007


SELECT *
FROM calendar,

     test_tab
WHERE cad_code = 'TESTCAL'
AND cad_date BETWEEN b AND c

TESTCAL	21/06/2007	1	21/06/2007	24/06/2007
TESTCAL	22/06/2007	1	21/06/2007	24/06/2007
TESTCAL	23/06/2007	1	21/06/2007	24/06/2007
TESTCAL	24/06/2007	1	21/06/2007	24/06/2007
TESTCAL	23/06/2007	2	23/06/2007	30/06/2007
TESTCAL	24/06/2007	2	23/06/2007	30/06/2007
TESTCAL	25/06/2007	2	23/06/2007	30/06/2007
TESTCAL	26/06/2007	2	23/06/2007	30/06/2007
TESTCAL	27/06/2007	2	23/06/2007	30/06/2007
TESTCAL	28/06/2007	2	23/06/2007	30/06/2007
TESTCAL	29/06/2007	2	23/06/2007	30/06/2007
TESTCAL	30/06/2007	2	23/06/2007	30/06/2007
Received on Thu Jun 21 2007 - 10:02:29 CDT

Original text of this message

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