> Hi everyone
>
> I have a large database which stores eventlogs for our programs etc
>
> I would like to be able to calculate the difference between time values in record 2 and record 1 and so on so that
> I end up with a database containing the difference between the timevalue in the current record and the record previous to this.
>
> I dont mind if the time calculations displays the information in minutes, seconds etc, i just need to be able to get this information.
>
> Any help would be much appreciated
>
> e.g.
>
>
>
> RECORD NO TIMELOGGED TIME DIFFERENCE
>
> 1 13:00.00 -
> 2 13:02.00 60 Seconds
> 3 13:05.00 180 Seconds
> 4 13:20.00 900 Seconds
>
>
> Kind regards
>
> Robbie
Because it's for fun, another SQL solution
CREATE CURSOR cCur (TIMELOGGED T)
INSERT INTO cCur VALUES (DATETIME(2016,8,3,13,0,0))
INSERT INTO cCur VALUES (DATETIME(2016,8,3,13,2,0))
INSERT INTO cCur VALUES (DATETIME(2016,8,3,13,5,0))
INSERT INTO cCur VALUES (DATETIME(2016,8,3,13,20,0))
SELECT RecordNo, TIMELOGGED, ;
IIF(RecordNo = 1,CAST(0 as integer), TIMELOGGED - (SELECT TIMELOGGED FROM cCurWithId c0 WHERE cCurWithId.RecordNo = c0.RecordNo + 1)) as TimeDifference ;
FROM cCurWithId
Respectfully
http://praisachion.blogspot.ro/