Reputation: 29
i have dataset as following.
client-Id Name HasCar HasHome
A01 ABC Y N
A01 ABC N N
B01 EFG N N
B01 EFG N Y
From here I need to derive a Single row for each customer whether he has car or home. the expected output should look like below
Client-Id Name HasCar HasHome
A01 ABC Y N
B01 EFG N Y
This needs to be done using a Hive-QL
Upvotes: 1
Views: 110
Reputation: 38335
Use max() aggregation:
select client-Id,Name, max(HasCar) HasCar, max(HasHome) HasHome
from your_table
group by client-Id,Name
Upvotes: 1