Forum Discussion

Ralf123's avatar
Ralf123
Frequent Visitor
8 years ago
Solved

Create column by comparing dates from different tables

Hello,

 

I want to add a column from another table after checking if a certain date falls between 2 dates from other columns.

 

I have 2 tables, Tables S/N used by

and

Table transactions (see both below).

 

I want to create a column 'ID nr.' in the transactions table (in red) and that ID nr. I get from 'Table S/N used by' after I checked if the date in the 'transactions table' falls between the 2 dates in 'Table S/N Used by'.

 

Table S/N used by   
idS/NUsed by ID nr.fromto
112345613-2-201714-2-2017
212378915-2-20716-2-2017
     

 

Table transactions    
idamountdateS/N ID nr.
11013-2-2018123 456
22014-2-2018123 456
32515-2-2018123 789
43016-2-2018123 789

 

Hopefully it is clear what I mean.

 

Thanks,

 

Ralf