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-Hive case statement with And condition

Highlighted

Hive-Hive case statement with And condition

New Contributor

Hi,

I am trying to use And condition in a case statement but it is not considering 2nd condition while executing.

Example:

select 

case when a =1 and b =2

then

"Data received"

END

Please let me know can we use And statement in case or not?

@Munnanani

 

1 REPLY 1
Highlighted

Re: Hive-Hive case statement with And condition

Rising Star

I just ran the following query through Hive and it worked as expected.

 

 

select 
    col1, 
    col2, 
    case when col1 = "Female" and col2 = "Yes" then "Data Received" end
from table_name limit 100;

 

 

Can you provide some steps to reproduce? 

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