Alan,

You could look at the TIMESTAMPDIFF scalar function.

I do not know the number of records in the file but you could perhaps use
the RRN function to make a join as well.

Something like (untested):
SELECT a.field1, b.field2, TIMESTAMPDIFF(8,a.timestamp,b.timestamp) AS
timediff
FROM filea a, filea b
WHERE RRN(a.filea) + 1 = RRN(b.filea)

If the RRN is not sequential (deleted records), also use the MIN function
(it requires a GROUP BY/HAVING-clause.

With regards,
Carel Teijgeler

*********** REPLY SEPARATOR ***********

On 2-4-2010 at 15:08 Alan Shore wrote:

I have a non-keyed file that is in chronological order. The record
contains a timestamp field.
How can I use SQL to determine the time difference (in seconds and parts
of seconds) between one record and the next




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.