Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to join two tables with multiple column?

I have created my tables using SQL statements in the Data Load Editor. I know that if the columns of two table are the same name they will be joined, however how do I join three columns of the two table together?

1 Solution

Accepted Solutions
vishalarote
Partner - Creator II
Partner - Creator II

Yes u just Concate the field

select (Column1,Column2) as Composite Key,Data1

from Table1;

select (Column1,Column2) as Composite Key,Data2

from Table2;

after that use join

select a.Composite Key,b.composite key, Data1, Data2

from Table1 a left join Table2 b

where a.Composite=b.Composite;

View solution in original post

5 Replies
jaumecf23
Creator III
Creator III

You will need to create a new field with the concatenation of the values of these three fields in both tables.

vishalarote
Partner - Creator II
Partner - Creator II

Make it Composite Key :

e.g

MainTable:

Load

Column1'-'Column2 as [Composite Key],

Data1

From Table1;

left join(MainTable)

Load

Column1'-'Column2 as [Composite Key],

Data2

From Table2;

Anonymous
Not applicable
Author

I am using the plain SQL no Qlik expressions can I generate composite  key on the plain sql?

vishalarote
Partner - Creator II
Partner - Creator II

Yes u just Concate the field

select (Column1,Column2) as Composite Key,Data1

from Table1;

select (Column1,Column2) as Composite Key,Data2

from Table2;

after that use join

select a.Composite Key,b.composite key, Data1, Data2

from Table1 a left join Table2 b

where a.Composite=b.Composite;

vishalarote
Partner - Creator II
Partner - Creator II

where a.Composite Key=b.Composite Key