Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
tan_chungkam
Creator
Creator

Left Join and Concatenate

I have 4 tables:

Table1:

MainOrder,

SalesAmount

Table2:

MainOrder,

BuildingType,

Cost

Table3:

MainOrder,

BuildingType,

Cost

Table4:

MainOrder,

BuildingType,

Cost

Tables consist all the mainorder from table2 to table4.

How could I combine these table into 1 table?

3 Replies
agni_gold
Specialist III
Specialist III

Go for Concatenate, and for data filtration purpose you can create one flag for each table while concatenating

undergrinder
Specialist II
Specialist II

Hi Chung,

I assume the MainOrder in every table is distinct, so I reccommend the following logic:

table_tmp:

Load

MainOrder,

BuildingType,

Cost,

null() as SalesAmount

From table1;

Load

MainOrder,

BuildingType,

Cost,

null() as SalesAmount

From table2;

Load

MainOrder,

null() as Cost

SalesAmount

From table3;

table_final:

Load

MainOrder,

BuildingType,

Cost,

Sum(SalesAmount)

resident table_tmp

group by

MainOrder,

BuildingType,

Cost;

So concatenate all tables, as Agnivesh Kumar suggested, and create a sum of SalesAmount to filter out the possible duplicates.

G.

Anil_Babu_Samineni

These tables do concatenate default. Just load and see in Model Viewer. Are there any Synthetic Keys formed?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful