T
Tim
Hi,
I have a table of records that represent sampled values in a time series.
For example,
SampleDateTime SampleValue
03/10/02 08:59:28 0.00234
03/10/02 08:59:40 0.00323
03/10/02 09:01:07 0.00374
03/11/03 08:57:54 0.00293
03/11/03 08:58:35 0.00385
03/11/03 09:59:22 0.00483
03/12/03 07:32:43 0.00263
03/13/03 06:34:23 0.00232
....
I need a query that will retrieve the most recent record prior to a
specified time for each day.
For example, using the above example data, if I wanted the most recent
record prior to 09:00:00 for each day, I would get the following records:
03/10/02 08:59:40 0.00323
03/11/03 08:58:35 0.00385
03/12/03 07:32:43 0.00263
....
I've tried all sorts of sub-queries, the TOP keyword, and lots of date
manipulation, but I've reached the limits of my humble knowledge. Any help
or pointers on the magic SQL incantation that I need to use would be greatly
appreciated.
Thanks. Tim
I have a table of records that represent sampled values in a time series.
For example,
SampleDateTime SampleValue
03/10/02 08:59:28 0.00234
03/10/02 08:59:40 0.00323
03/10/02 09:01:07 0.00374
03/11/03 08:57:54 0.00293
03/11/03 08:58:35 0.00385
03/11/03 09:59:22 0.00483
03/12/03 07:32:43 0.00263
03/13/03 06:34:23 0.00232
....
I need a query that will retrieve the most recent record prior to a
specified time for each day.
For example, using the above example data, if I wanted the most recent
record prior to 09:00:00 for each day, I would get the following records:
03/10/02 08:59:40 0.00323
03/11/03 08:58:35 0.00385
03/12/03 07:32:43 0.00263
....
I've tried all sorts of sub-queries, the TOP keyword, and lots of date
manipulation, but I've reached the limits of my humble knowledge. Any help
or pointers on the magic SQL incantation that I need to use would be greatly
appreciated.
Thanks. Tim