Say I have two tables:
a:
timestamp | precipitation |
---|---|
2015-08-03 21:00:00 UTC | 3 |
2015-08-03 22:00:00 UTC | 3 |
2015-08-04 3:00:00 UTC | 4 |
2016-02-04 18:00:00 UTC | 4 |
and b:
timestamp | loc |
---|---|
2015-08-03 21:23:00 UTC | San Francisco |
2016-02-04 16:04:00 UTC | New York |
I want to join to get a table who has fuzzy joined entries where every row in b tries to get joined to a row in a. Criteria:
- The time is within 60 minutes. If a match does not exist within 60 minutes, do not include that row in the output.
- In the case of a tie where some row in b could join onto two rows in a, pick the closest one in terms of time.
Example Output:
timestamp | loc | precipitation |
---|---|---|
2015-08-03 21:00:00 UTC | San Francisco | 3 |