| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL question
Hi !
If you want all intervalls between the dates of a date-column for all rows then use this:
select next.date_col - max(previous.date_col)
from your_tab next, your_tab previous
where previous.date_col < next.date_col
group by next.date_col;
U will get the result in days.
Greez,
Angelo.
Marco Nedermeijer wrote:
>
> I'm trying to create a sql-statement to do the following:
>
> i want to substract a date-field from a date-field of a previous record. my
> guess is that i need to use ROWNUM for this.
>
> Can someone help me to create this statement ?
>
> Thanks,
>
> Marco Nedermeijer
> m.n.nedermeijer_at_rtd.nl
-- ----------------------------------------------------------------- Angelo Cavallaro / / / \ TECTUM Beratungsgesellschaft ORACLE-SW-Berater / / / \ für Informationsverarbeitung ancavall.NOSPAM / / /-------\ Tel: 0711/99073-10 @aol.com /__/__/_________\ Fax: 0711/99073-99 ----------------------------------------------------------------- Visit the Home of the Green Ribbon Campaign: http://www.ponce.oisoft.com/ -----------------------------------------------------------------Received on Tue Mar 03 1998 - 00:00:00 CST
![]() |
![]() |