Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Joining tables

I have three tables t1, t2 and t3 with keys k1, k1+k2 and k2 respectively. (Essentially, t2 connects t1 and t3) I need to filter the records from t2 which match the key values in t1 and then join the resultant to t3. Can any one suggest the proper join conditions?

If I use left join with t2 as the main table, I end up picking extra values from t1 and if I use t1 as the main table then there is no way for me to get data from t3.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Not really sure, so if this is not what you want, could you post few lines of input table records and your expected result table?

t1:

LOAD k1 FROM t1;

t2:

LEFT KEEP

LOAD k1,k2 FROM t2;

JOIN

LOAD k2 FROM t3;

DROP TABLE t1;

View solution in original post

5 Replies
swuehl
MVP
MVP

Not really sure, so if this is not what you want, could you post few lines of input table records and your expected result table?

t1:

LOAD k1 FROM t1;

t2:

LEFT KEEP

LOAD k1,k2 FROM t2;

JOIN

LOAD k2 FROM t3;

DROP TABLE t1;

Not applicable
Author

How do I join t3 because there is no t2 once I left join it.I get error saying table not found. Do I join it to t1?

Also, my tables have other data as well and not just the keys!

swuehl
MVP
MVP

No, I did a LEFT KEEP

Not applicable
Author

Aah.. I was under the impression that I have to specify the table name when I join the two tables. but even without specifying table names, Qlik automatically identifies association based on column names.

Thank you Swuehl! Keep is a Keeper   lol never understood the use of it till now.

I also found this helpful after reading your post.

https://help.qlik.com/en-US/sense/2.2/Subsystems/Hub/Content/Scripting/combine-tables-join-keep.htm

swuehl
MVP
MVP

The JOIN / KEEP is performed to the table preceding the current LOAD statement in the script, if you don't sepcify a table name (which would be more safe, advisable).

It is not searching your data model for possible matching key fields, if that is what you are assuming.