I wish to use a date time stamp as the join between 2 tables in order to perform various queries. My issue is this:
Table1 - this is a time series table, has date time stamps that may be in any interval (every 15 minutes, every 30 minutes, or no consistent interval at all). This table has many more records than Table2, as it is data from stream height recorders that is collected on a much higher frequency than Table2, which only has date times from site visits (this may occur anywhere from once or twice a day to only once a month).
Table2 - this table has date time stamps that could be any date time, whenever a person visits a site, they record the current date time
I have been able to join two tables with a date time stamp before, but the way I did it was to have Table1 have 15 minute intervals rounded to the 5th decimal place, and the same for Table2. This is not flexible enough, I want to be able to join Table1 and Table2 based on "the nearest date time match" when both tables have inconsistent times that don't match exactly.
My best stab at how to tackle this would be to use an update query that for each value in Table2, the nearest date time match in Table1 would be written to another field (field1 lets call it) in the same record in Table2. Then I use field1 of Table2 to join to Table1 rather than the original date time on Table2 which has a nearly 0% to have an exact match on Table1. The problem with my idea is I do not know how to take a date time from one table and look for the nearest match on another, and write that date time back to the table.
Perhaps this is better accomplished using VBA? Maybe there is a better solution than I can visualize? Maybe I am just lacking the simple skill to finding the nearest times?
I sincerely appreciate your assistance
Table1 - this is a time series table, has date time stamps that may be in any interval (every 15 minutes, every 30 minutes, or no consistent interval at all). This table has many more records than Table2, as it is data from stream height recorders that is collected on a much higher frequency than Table2, which only has date times from site visits (this may occur anywhere from once or twice a day to only once a month).
Table2 - this table has date time stamps that could be any date time, whenever a person visits a site, they record the current date time
I have been able to join two tables with a date time stamp before, but the way I did it was to have Table1 have 15 minute intervals rounded to the 5th decimal place, and the same for Table2. This is not flexible enough, I want to be able to join Table1 and Table2 based on "the nearest date time match" when both tables have inconsistent times that don't match exactly.
My best stab at how to tackle this would be to use an update query that for each value in Table2, the nearest date time match in Table1 would be written to another field (field1 lets call it) in the same record in Table2. Then I use field1 of Table2 to join to Table1 rather than the original date time on Table2 which has a nearly 0% to have an exact match on Table1. The problem with my idea is I do not know how to take a date time from one table and look for the nearest match on another, and write that date time back to the table.
Perhaps this is better accomplished using VBA? Maybe there is a better solution than I can visualize? Maybe I am just lacking the simple skill to finding the nearest times?
I sincerely appreciate your assistance