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

Join and Concat with SQL

Hi All,

Quick question, I have two tables loaded from an SQL database.

TABLE1:

A

B

C

TABLE2:

A

D

My desired output is:

-----------------

TABLE3:

A&B

C

D

-----------------------

A & B should be grouped into one single column, please keep in mind that these two tables are coming from an SQL DB and I am currently joining them with a Join().

Thanks

Labels (3)
2 Replies
asinha1991
Creator III
Creator III

Load both the tables as it is and do this

 

Table 3:

Load A&B as key,

C,

D;

left join(Table2)

Load * Resident Table1;

 

jonathandienst
Partner - Champion III
Partner - Champion III

If A is the only join key, then do this in three steps - concatenate the A and B values, then join the two on A, and finally drop the A and B values.

LOAD A, B, C, D, A & B as AB
FROM ...

Left Join
LOAD A, D
FROM ...

DROP Fields A, B;

If the join key is more than just A, then you will need to supply more details.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein