Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Time difference between records
"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)
Btw, don't cross/multipost, we read all the cdo groups.
-- Regards Michel CadotReceived on Tue Sep 14 2004 - 11:21:55 CDT
![]() |
![]() |