How to select max value from timeseries data

Hi everyone.
This is my first post in this forum so it might not be perfect.

Here I go:
I have a MASSIVE database (SQL 2008) with data on vehicle speed for alot of vehicles that have been recorded.
The table consists of timestamp(hh/mm/ss) vehicle ID, speed.

Now, I need to find certain events, i.e overtakings. using this data.
Say that if the speed is > 70 then I consider it to be the beginning of an overtaking. The problem is that the overtaking takes some time and alot of data with values beyond this "triggervalue" is actually the same event. So I don't want every value over 70 to be selected.

What I want is that when the Query finds a value >70 then it should look at the values following this value (for 1 minute, remember all values has a timestamp) and select the maximum value and the go on to the next event.



Did it make sense?




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories