eulerto / pg_similarity

set of functions and operators for executing similarity queries
BSD 3-Clause "New" or "Revised" License
363 stars 39 forks source link

Comparing timestamps #27

Open jacektrocinski opened 5 years ago

jacektrocinski commented 5 years ago

Hi,

Is there a good way to compare similarities between timestamps with pg_similarity? E.g.:

Table A

City Arrival Time
Los Angeles 2019-03-05 11:00:00.00000+00
Hong Kong 2019-03-07 17:00:00.00000+00

Table B

City Arrival Time
Los Angeles 2019-03-06 13:00:00.00000+00
Los Angeles 2019-03-01 11:00:00.00000+00

When joining Table A and Table B I would like to return only the rows which are most similar, in this case the rows Los Angeles with arrival dates on 2019-03-05 and 2019-03-06 are the closest matches.