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: Query on previous row value

Re: Query on previous row value

From: Richard Kuhler <noone_at_nowhere.com>
Date: Fri, 12 Apr 2002 20:30:10 GMT
Message-ID: <mtHt8.36961$VQ2.18906108@twister.socal.rr.com>


Well, assuming the date span can't be more than 24 hours...

select to_char(t_date, 'HH24:MI:SS'),
  to_char(to_date('01-jan-1900', 'dd-mon-yyyy')     + (t_date - lag(t_date, 1) over (order by t_date))   , 'HH24:MI:SS')
from x

Richard

Jeff Pope wrote:
>
> Here's my problem. I need to generate a query that will display a date
> field then the computed time lapse from the queries' previous row.
>
> T_DATE
> -------
> 11:34:17
> 11:35:32
> 11:42:32
>
> I need to display
>
> T_DATE TIME_LAPSE
> ------- --------
> 11:34:17 (null)
> 11:35:32 00:01:15
> 11:42:32 00:07:00
>
> Please advise. Thanks
>
> Jeff
Received on Fri Apr 12 2002 - 15:30:10 CDT

Original text of this message

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