Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chrisk44
Contributor III
Contributor III

Left Join Table

I got problem with joining 2 tables:

 

1 - TABLE:

DATE_FROM_T1DATE_TO_T1NO_T1KEY_T1
01.08.200831.07.2011572757271
02.01.2014 572757272
04.08.200820.01.2015572957291
21.01.201520.01.2019572957291

 

2 - TABLE

DATE_T2NO_T2
01.07.20105727
01.07.20185727
01.09.20105729
01.07.20185729

 

3 - Destination table

DATE_T2NO_T2KEY_T1
01.07.2010572757271
01.07.2018572757272
01.09.2010572957291
01.07.2018572957291

 

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.

2 Replies
NhanNguyen
Contributor III
Contributor III

Try to rename NO_T2 as NO_T1 if you don't specify on the key fields
marcus_sommer

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