Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
WE ARE LISTENING! New Navigation for Qlik Community, Sept. 26: TELL ME MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Derek_T
Contributor III
Contributor III

How to combine 2 tables ?

I chose the word "combine" because I don't think it's a join (no common Key).
I have two very simple tables and the expected results is in yellow.

is there an "elegant" way to do this using Script ? 

Capture.PNG

Thanks

Labels (2)
2 Solutions

Accepted Solutions
Or
Champion
Champion

Load * From Table1;

JOIN

Load * From Table2;

Should work here, I believe.

View solution in original post

sidhiq91
Specialist
Specialist

@Derek_T  You may even prefer Outer Join instead of just JOIN. Both produce the same result. See below for the code. When there is no common key to make a join, a simple JOIN prefix or Outer JOIN can be used to combine the tables.

NoConcatenate
Temp1:
Load * inline [
Data1
A,
B,
C
];

outer Join (Temp1)
Temp2:
Load * inline [
Data2
1,
2,
3
];

Exit Script;

View solution in original post

6 Replies
Or
Champion
Champion

Load * From Table1;

JOIN

Load * From Table2;

Should work here, I believe.

Fernando_Fabregas

Before the first load add NoConcatenate to generate another table...

sidhiq91
Specialist
Specialist

@Derek_T  I can the answer as you expected using below script. Please try and let us know.

NoConcatenate
Temp1:
Load * inline [
Data1
A,
B,
C
];

Join (Temp1)
Temp2:
Load * inline [
Data2
1,
2,
3
];

Exit Script;

sidhiq91
Specialist
Specialist

@Derek_T  You may even prefer Outer Join instead of just JOIN. Both produce the same result. See below for the code. When there is no common key to make a join, a simple JOIN prefix or Outer JOIN can be used to combine the tables.

NoConcatenate
Temp1:
Load * inline [
Data1
A,
B,
C
];

outer Join (Temp1)
Temp2:
Load * inline [
Data2
1,
2,
3
];

Exit Script;

Derek_T
Contributor III
Contributor III
Author

Thanks, worked like charm. I did not expect an outer join to work with no common keys.
I though this would just create empty field in front of each table column.

Or
Champion
Champion

The "Outer" isn't necessary. A simple "Join" will provide the Cartesian of the two tables if they have no common fields (there's nothing to Outer join on with no matching fields). For clarity, I'd suggest avoiding the "Outer" part.