View Full Version : Time difference between records
Scott Johnson
09-14-2004, 06:49 AM
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?
Hans Forbrich
09-14-2004, 07:12 AM
Scott Johnson wrote:
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?
1) Ain't going nowhere if you don't capture a 'modified date/time' stamp.
2) Different database version provide different capabilities to help here.
3) In 10g look up the time interval datatype, otherwise look up date
arithmetic, both in the SQL Reference manual.
FredBear
09-14-2004, 08:21 AM
"Scott Johnson" <stj_spam@yahoo.com> a écrit dans le message de
news:414702d0$0$26167$bb8e7a08@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
Clam entreprenur
09-14-2004, 02:57 PM
TIME - most priced commodity; early bird...
- depreciation in value for inventory overstock, new car out of the
door is starting depreciating in value
- comply to work order, job contract, efficiency operation meeting
time line
- sufficient time for head up in magnified problem???!!!????
Select All where Time(2004), do constructive competition, coordinated synergy
Connie Lam
conniemlam2002@yahoo.com
CLAM ENTREPRENURIAL RESEARCH
MyLounge.com Site Map
Forum:
Cars,
Cell Phone,
Database,
Games,
Home Improvement,
IT,
Music,
School,
Sports,
Web Design,
Web Server,
Weight Loss
The MyLounge.com forum is intended for informational use only and should not
be relied upon and is not a substitute for any advice. The information contained
on MyLounge.com are opinions and suggestions of members and is not a representation
of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for
the accuracy, completeness or usefulness of any postings or the qualifications
of any person responding. Please consult a expert or seek the services of an
attorney in your area for more accuracy on your specific situation. Please note
that our forums also serve as mirrors to Usenet newsgroups. Many posts you see
on our forums are made by newsgroup users who may not be members of MyLounge.com
Term of Service
vBulletin v3.0.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.