Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: one row for each day in date range ? [opposite of 'join' ?]
"Richard Shea" <rshea_at_my-deja.com> a écrit dans le message news:
43160f6f.0109110154.6cd76275_at_posting.google.com...
> Hi - I've got a table with two columns :
>
> datefrom
> dateto
>
> I would like to produce a view which contained (for each record
> selected) a row for each day in the range. That is if I selected one
> row with values :
>
> datefrom=2001-09-01
> dateto=2001-09-05
>
> I got in the view something like this :
>
> deriveddate datefrom dateto
> 2001-09-01 2001-09-01 2001-09-05
> 2001-09-02 2001-09-01 2001-09-05
> 2001-09-03 2001-09-01 2001-09-05
> 2001-09-04 2001-09-01 2001-09-05
> 2001-09-05 2001-09-01 2001-09-05
>
> It seems to me this is sort of the opposite of 'group by' !
>
> Anyone got any ideas ?
>
> thanks
>
> richard shea.
v815> define datefrom="2001-09-01" v815> define dateto="2001-09-05" v815> select to_char(to_date('&datefrom','YYYY-MM-DD')+rownum-1,'YYYY-MM-DD')2 from all_objects
TO_CHAR(TO
2001-09-01 2001-09-02 2001-09-03 2001-09-04 2001-09-05
5 rows selected.
-- Have a nice day MichelReceived on Tue Sep 11 2001 - 06:32:09 CDT
![]() |
![]() |