Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Merging Tables

Hello,

What is the best way to merge two tables while loading?

I have a table X with some data by project, and table Y with one data by project.

I tested "Concatenate", but it wasn't what I was expecting; also with "Join" and something went weired: the value of one key item is doubled when I use Join.

I'm doing something wrong? Is there any other way to do this?

Thanks

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

If you want  merging tables by using concatenate function make sure most of the field names should be the same between the tables and the another by using join make sure at least one key should be the same with values in both tables else it will take cartesian join..

By default Qlikview will treat join as outer join if you want to avoid duplicates you can use either left or right join..

View solution in original post

2 Replies
nagaiank
Specialist III
Specialist III

If both the tables have same number of fields with the same fieldnames, concatenating them will work without any problem.

In your case, there are differences in the columns between the the two tables. In such cases, the following method has worked for me:

Let us assume that Common1 and Common2 are the fields common in both tables (Table1 and Table2). If Table1 has the fields Data1a and Data1b which are not in Table2, and Table2 has fields Data2a and Data2b which are not in Table1, the following script will merge the two tables:

MergedTable:

Load * Inline [

Common1, Common2, Data1a, Data1b, Data2a, Data2b

];

Concatenate Load Common1, Common2, Data1a, Data1b from Table1;

Concatenate Load Common1, Common2, Data2a, Data2b from Table2;

Not applicable
Author

Hi,

If you want  merging tables by using concatenate function make sure most of the field names should be the same between the tables and the another by using join make sure at least one key should be the same with values in both tables else it will take cartesian join..

By default Qlikview will treat join as outer join if you want to avoid duplicates you can use either left or right join..