Forum Discussion
Ralf123
8 years agoFrequent Visitor
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 | ||||
| id | S/N | Used by ID nr. | from | to |
| 1 | 123 | 456 | 13-2-2017 | 14-2-2017 |
| 2 | 123 | 789 | 15-2-207 | 16-2-2017 |
| Table transactions | |||||
| id | amount | date | S/N | ID nr. | |
| 1 | 10 | 13-2-2018 | 123 | 456 | |
| 2 | 20 | 14-2-2018 | 123 | 456 | |
| 3 | 25 | 15-2-2018 | 123 | 789 | |
| 4 | 30 | 16-2-2018 | 123 | 789 |
Hopefully it is clear what I mean.
Thanks,
Ralf
Great. This was very helpful. Thanks
2 Replies
- Zubair_MuhammadCommunity Champion
- Ralf123Frequent Visitor
Great. This was very helpful. Thanks