Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Claudiu_Anghelescu
Specialist
Specialist

LEFT OUTER JOIN SQL in Qlik

How to handle LEFT OUTER JOIN with the following ON Clause?

 

TABLE_A

....

LEFT OUTER JOIN TABLE_B ON TABLE_B.[Item] = TABLE_A.[Item] and (TABLE_B.[Region Code] = 0 or TABLE_B.[Country Code] = TABLE_A.[Country Code])

To help community find solutions, please don't forget to mark as correct.
Labels (3)
1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

noconcatenate
TABLE_B:
LOAD <Columns in table B>,
Table_B.Item as Item,
Table_B.Country_Code as Country_Code
RESIDENT tempTABLE_B
where [Region_Code]=0;

drop table tempTABLE_B;

left join(TABLE_B)
load
<Columns in table A>,
Table_A.Item as Item,
Table_A.Country_Code as Country_Code
resident
TABLE_A

 

The idea here is to switch sql <on> clause to columns with the same name in both table,
ideally the key to join both tables.

View solution in original post

1 Reply
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

noconcatenate
TABLE_B:
LOAD <Columns in table B>,
Table_B.Item as Item,
Table_B.Country_Code as Country_Code
RESIDENT tempTABLE_B
where [Region_Code]=0;

drop table tempTABLE_B;

left join(TABLE_B)
load
<Columns in table A>,
Table_A.Item as Item,
Table_A.Country_Code as Country_Code
resident
TABLE_A

 

The idea here is to switch sql <on> clause to columns with the same name in both table,
ideally the key to join both tables.