cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
jbakri
Level II

How to join two tables on datatime columns that match within 1 minute

Hello All,

 

I have two data tables that I am trying to join. They both contain a datetime column that I would like to use to match up the rows. The problem is the datetimes can be off by at most 1 minute due to some inconsistencies in how table B is rounding its values. For example, on table A the datetime might be 2022-10-03 22:13:47 and on table B it will round down to 2022-10-03 22:13:00, but for another row table A will be 2022-10-03 15:09:33 and Table B will round up to 2022-10-03 15:10:00. I have not been able to identify any pattern as to which way Table B will round its values and I cannot change the way it is storing the data.

 

The values are always within ±1 minute, but it is inconsistent whether I need to round up or down. Is there a way to join the tables and match the two columns anywhere the times are within 1 min of each other?

 

Thanks

2 REPLIES 2
jthi
Super User

Re: How to join two tables on datatime columns that match within 1 minute

This discussion might have some ideas How do I join tables based on one fully matching column and one closest matching? or you could try with add-in I have written Join Nearest Rows - Join tables by using continuous columns and nearest values (it might be a bit finicky to use, sorry about that).

-Jarmo
jbakri
Level II

Re: How to join two tables on datatime columns that match within 1 minute

Thanks for the suggests! I ended up creating two new columns. The first column rounds down to the nearest minute and the second rounds up. I then do the join in two steps. Works well enough for my purposes. Thanks!