Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
tango
Contributor III
Contributor III

Concatenate 3 tables with Left join

Hi, 

I have 3 tables (B,C,D)which needs to be joined to a another table (A) in such a way that A should be joined to B by Left Join and accordingly C & D with A.

Now what I have tried is ,creating a left join and each section like separate table and simultaneously in next 2 sections for C & D. its creating synthetic key ,I am not sure how should I concatenate them , because Concatenate between 2 tables gives me Full Join which i do not want.

Please help.

Thanks

Labels (1)
15 Replies
BrunPierre
Partner - Master
Partner - Master

I'm not sure what you're trying to accomplish, but perhaps this?

MainTable:
LOAD * FROM MainTable;

Noconcatenate
NewSourceTable:
LOAD ID,
Name,
Date

Resident MainTable;
DROP Table MainTable;

Left Join(NewSourceTable)
LOAD ID,
Date,
Title
FROM Table1;

Left Join(NewSourceTable)
LOAD ID,
Date,
Address
FROM Table2;

Left Join(NewSourceTable)
LOAD ID,
Date,
Country
FROM Table3;

Noconcatenate
FinalTable:
LOAD ID,
Name,
Title,
Date,
Address,
Title &' '& Name as [Name Title], //Calculated field
Country &'-'& Address as [Residential Address] //Calculated field

Resident NewSourceTable;
DROP Table NewSourceTable;

tango
Contributor III
Contributor III
Author

roopalichavan9274_0-1677073020467.png

This Left join doesn't gives me correct number of ID because its counting the ID from another table when performing left join in 2nd part. 1st table left join throws correct distinct ID but then 2nd table left join is throwing ID (considering some ID from 1st table too).

edwin
Master II
Master II

you should drop Table1, Table2, and Table3.  perhaps the issue you are encountering is due to synthetic tables.

tango
Contributor III
Contributor III
Author

this means 

Maintable:

Load ID, NAME;

table1:

Left Join(Maintable)

Load Title

resident Maintable;

table2:

Left Join(Maintable)

Load Country

resident Maintable;

 

Now where should I drop table1 and table2 as they are joined with MainTable.

Sorry for being so at beginner level. but getting confused.

 

BrunPierre
Partner - Master
Partner - Master

Can you share some actual data sample and desired output, maybe there are other ways to achieve the same results.

edwin
Master II
Master II

it sounds like you really dont have table1, table2.  from your code you are actually trying to load table1 and table2 from the data in Maintable.

i dont think you are using the right statements.  from the looks of it, your source table is Maintable.  i suggest you add the following before you start your left joins:

exit script;

then take a screenshot of your data model.  this will help everyone understand your baseline tables.  then show us what you want to achieve.