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

Home -> Community -> Usenet -> c.d.o.misc -> Re: for each from/to date in table, select days between from/to date?

Re: for each from/to date in table, select days between from/to date?

From: Alien <stijf_at_stijf.com>
Date: 27 Feb 2006 07:17:10 -0800
Message-ID: <1141053430.867098.82420@p10g2000cwp.googlegroups.com>


Hi,

How about this:

SQL> ed
file afiedt.buf is weggeschreven.

  1 select a.name,a.colour,a.fd,a.td,a.fd+b.rn dt from   2 (select name,colour,fromdate fd,todate td, todate-fromdate nm   3 from names) a,
  4 (select rownum-1 rn from dual connect by 1=1 and rownum<365) b   5 where b.rn<=a.nm
  6* order by a.name,b.rn
SQL> /

NAME                                               COLOUR
                              FD       TD       DT

--------------------------------------------------
-------------------------------------------------
Bob Red 07-01-06 09-01-06 07-01-06 Bob Red 07-01-06 09-01-06 08-01-06 Bob Red 07-01-06 09-01-06 09-01-06 Fred Green 01-01-06 04-01-06 01-01-06 Fred Green 01-01-06 04-01-06 02-01-06 Fred Green 01-01-06 04-01-06 03-01-06 Fred Green 01-01-06 04-01-06 04-01-06

7 rijen zijn geselecteerd.

SQL> Regards,

Arian Received on Mon Feb 27 2006 - 09:17:10 CST

Original text of this message

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