Re: scanning for data gaps in time series
What about...
SELECT a.datetime starttime
, b.datetime stoptime
, TIMEDIFF(b.datetime,a.datetime) gap
FROM
( SELECT x.*
, COUNT(*) rank
FROM as_follows x
JOIN as_follows y
ON y.datetime <= x.datetime
GROUP
BY x.datetime
) a
JOIN
( SELECT x.*
, COUNT(*) rank
FROM as_follows x
JOIN as_follows y
ON y.datetime <= x.datetime
GROUP
BY x.datetime
) b
ON b.rank = a.rank + 1
AND b.datetime > ADDDATE(a.datetime,INTERVAL 2 MINUTE);
?
Subject
Written By
Posted
Re: scanning for data gaps in time series
July 16, 2011 05:12AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.