I have a table which looks like the following:
index | timestamp | type | value
------- | ----------------- | ---- | -----
1 | 2014-07-10 10:00 | A | 56
2 | 2014-07-10 11:04 | B | 69
3 | 2014-07-10 11:06 | C | 68
4 | 2014-07-10 10:03 | B | 60
5 | 2014-07-11 10:03 | B | 18
6 | 2014-07-11 11:03 | C | 48
I am willing to select a period of values for certain 'types'.
The problem is that I also need the result to include the last value of each type before the selected period starts.
Any idea if it is possible to achieve with a single query (or at list limited number of queries)?
Thanks Meir
timestamp >= '2014-07-11', I want to have all lines except 4 (because last value of type B before 2014-07-11 is in line 2)