Subquery?

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have a table looking like this:


Timekey Value
********** *******

1 1.3
2 1.45
3 1.5
4 1.4
5 1.6
6 1.8

I now would like to generate a table, showing the Max Value of a
interval with a specific length (let's assume 3) starting at every
possible Timekey.

To make this clearer – the result should look like this:


Start_Interval_Timkey Max_Value_Interval
********************** ***********************
1 1.5 (Comment: the relevant values were 1.3,
1.45, 1.5)
2 1.5
3 1.6
4 1.8

Can someone help???
 
IF your timekey is always sequential, then you could do something like.


SELECT M.TimeKey,
DMax("[Value]","Table",
"TimeKey =>" & M.TimeKey & " AND TimeKey <" M.TimeKey + 2) as NewMax
FROM Table as M


If Timekey is not a sequential number then this becomes more complex.
 
Back
Top