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: Time difference between records

Re: Time difference between records

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Tue, 14 Sep 2004 18:21:55 +0200
Message-ID: <41471a02$0$20456$626a14ce@news.free.fr>

"Scott Johnson" <stj_spam_at_yahoo.com> a écrit dans le message de news:414702d0$0$26167$bb8e7a08_at_news.usenetcompany.com...
> I need to find a method (sql, plsql) to find the time difference between
> records
>
> Example,
> Ticket# Operation Time
> A1 Modify 1000
> A1 Modify 1100
> A1 Modify 1300
> A2 Modify 0900
> A2 Modify 0930
>
> Should produce something like:
>
> A1 1 hour
> A1 2 hours
> A2 30 minutes
>
> Has anyone done this before?
>
>

Just a hint:

select ticket#, diff
from (select ticket#,

                   time-lag(time) over (partition by ticket# order by time) diff
         from mytable)

where diff is not null
/

Btw, don't cross/multipost, we read all the cdo groups.

-- 
Regards
Michel Cadot
Received on Tue Sep 14 2004 - 11:21:55 CDT

Original text of this message

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