Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Hive-Hive case statement with And condition

avatar
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

avatar
Master Collaborator

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?