Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Tribhuwan
Contributor
Contributor

Match values of 2 columns from different tables

Hello Everyone,

I need to match column of 2 different tables to create a new column while loading data. In the below code I am trying to match Concat1 column in both the tables but its not working. Could someone please help me in getting it resolve

 

Country_Region_Mapping:
LOAD
L1_Final,
L2_Final,
L3_Final,
Concat1,
Flag
FROM [lib://D&B Info Input File - DUNS (internal_pverma3)/Country_Region Mapping.xlsx]
(ooxml, embedded labels, table is Sheet1);

 

 

Final_Customer_Counter:
Right Join(Country_Region_Mapping)
NoConcatenate Load
OCN,
ACCOUNT_NAME,
CUP_ID,
CUP_NAME,
CUP_COUNTRY,
CORRECT_OCN,
OCN_COUNTRY_NAME,
ACCOUNT_STATUS_CUP_LEVEL,
CUP_HQ_Country_same_as_OCN_Country,
L1,
L2,
L3,
L1_MANAGER_NAME,
if((REVENUE_BY_OCN<0 OR REVENUE_BY_OCN>0),1,0) as 'Revenue_Flag',
if((CUP_COUNTRY&L2&L3)=Concat1,1,0) as 'Country_Region_Mapping',
If(upper(OCN_COUNTRY_NAME)=upper(CUP_COUNTRY),1,0) as 'OCN_CUP_Country_Match',
REVENUE_BY_OCN,
If((REVENUE_BY_OCN<0 OR REVENUE_BY_OCN>0),'Customer','Prospect') as 'Account_Status_OCN_Level'
Resident FINAL_SAP_HANA
where ACCOUNT_STATUS_CUP_LEVEL='Customer';
drop table FINAL_SAP_HANA;

Labels (2)
2 Replies
AronC
Partner - Creator II
Partner - Creator II

@Tribhuwan I am not to clear what your are trying to achieve. What does your error message says or what is the outcome now?

Do you have some sample data of the most important fields that you want to join.

When you join to tables there must be a field name that is the same in both tables.
Now you only have Concat1 in one of the tables. In the other table you had that field but renamed it so it doesn't exist anymore. You renamed the field as the name of the other table.



Also when you rename the fields use [] instead, i.e myOldFieldName as [MyNewFieldName]

anat
Master
Master