Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

HIVE Merge Multiple MATCH Conditions

Highlighted

HIVE Merge Multiple MATCH Conditions

New Contributor

Hi Team,

Can you please let us know how to implement the below logic with HIVE merge multiple match actions.

MERGE INTO Target_table AS T

USING Source_Table AS S

ON S.col1=T.col1


WHEN MATCHED THEN UPDATE SET T.col2=S.col2


WHEN MATCHED THEN INSERT VALUES ("DUMMY",S.col2,S.col3)


WHEN NOT MATCHED THEN INSERT VALUES ("NEW",S.col2,S.col3) ;

1 REPLY 1

Re: HIVE Merge Multiple MATCH Conditions

New Contributor

We have to do insert and update on the same table when the condition is MATCHED

Don't have an account?
Coming from Hortonworks? Activate your account here