Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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])
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.
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.