SQLite Forum

Nearest-match join
I would use the WINDOW functionality to get the previous timestamp to the same row at which I am looking for the nearest match and then use both times (from and to) to make an left outer join to the 2nd table and get all the timestamp which fell into the time frame.

My approach does not only look for one record, which is "the" closest but tries to compare all records in a "diff" way. It can be that you get none, one or several occurancies for each frame on the left - no record will get lost but shown - however, you have to expect NULL columns with my method.