Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Merge 2 tables into one

Hi guys

I have 2 tables. On has got the following fields: Third Party, Group.

The other has got the following fields: Marine, PC

How do I get to merge these two tables so that it displays for example: Third Party Marine or Group PC.

Thanks

1 Solution

Accepted Solutions
Bjorn_Wedbratt
Employee
Employee

You then need to join the two tables over the ItemCode field (which could be seen as the primary key in this case). Pay attention to the relationship between the three tables or you will end up with a Cartesian product. You should have a relationship that is one-to-many-to-one between the three tables (with the ItemCode field linking the two other tables together). So it could be something like:

Load PC, Marine, ItemCode From table1;
JOIN
Load ItemCode From table2;
JOIN
Load ItemCode, Third Party, Group From table3;

Depending on the result you want you might need to do LEFT/RIGHT joins.

View solution in original post

3 Replies
Or
MVP
MVP

Based on your post, it isn't clear if there is any relation between these two tables.. it doesn't sound like there is, though. You can force the two to be joined by adding a JOIN keyword between the two LOADs - but this will result in a cartesian join, which may not be what you want.

Not applicable
Author

Note that there is a relation between the two tables. Both are linked to an ItemCode.

If I select an ItemCode I get either PC/Marine in the one table & Third Party/Group in the other table.

Bjorn_Wedbratt
Employee
Employee

You then need to join the two tables over the ItemCode field (which could be seen as the primary key in this case). Pay attention to the relationship between the three tables or you will end up with a Cartesian product. You should have a relationship that is one-to-many-to-one between the three tables (with the ItemCode field linking the two other tables together). So it could be something like:

Load PC, Marine, ItemCode From table1;
JOIN
Load ItemCode From table2;
JOIN
Load ItemCode, Third Party, Group From table3;

Depending on the result you want you might need to do LEFT/RIGHT joins.