Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I got problem with joining 2 tables:
1 - TABLE:
DATE_FROM_T1 | DATE_TO_T1 | NO_T1 | KEY_T1 |
01.08.2008 | 31.07.2011 | 5727 | 57271 |
02.01.2014 | 5727 | 57272 | |
04.08.2008 | 20.01.2015 | 5729 | 57291 |
21.01.2015 | 20.01.2019 | 5729 | 57291 |
2 - TABLE
DATE_T2 | NO_T2 |
01.07.2010 | 5727 |
01.07.2018 | 5727 |
01.09.2010 | 5729 |
01.07.2018 | 5729 |
3 - Destination table
DATE_T2 | NO_T2 | KEY_T1 |
01.07.2010 | 5727 | 57271 |
01.07.2018 | 5727 | 57272 |
01.09.2010 | 5729 | 57291 |
01.07.2018 | 5729 | 57291 |
I've tried:
[TABLE_1]:
load DATE_FROM_T1,DATE_TO_T1,NO_T1,KEY_T1
from...
[TABLE_2]:
load DATE_T2, NO_T2
from ...
left join (TABLE_2)
load
Klucz2
Resident TABLE1
where
NO_T2=NO_T1
and DATE_T2 >= DATE_FROM_T1
and DATE_T2 <= DATE_TO_T1
however got error:
field not found NO_T2 (etc. for each field from table 2)
Please help.
You need to do at first some kind of intervalmatching before you could join the tables, for example with something like this:
t1: load date(FROM + iterno() - 1) as DATE, NO, KEY from t1 while FROM + iterno() - 1 <= TO;
right join(t1) load DATE, NO from t2;
- Marcus