My input file is like this:
id,phnName,price,model
1,iphone,2000,abc
2,iphone,3000,abc1
3,nokia,4000,abc2
4,sony,5000,abc3
5,nokia,6000,abc4
6,iphone,7000,abc5
7,nokia,8500,abc6
I want to write a hive query to get the max count of a particular phone.
output:
iphone 3
nokia 3
till now I've tried the following query:
select d.phnName,count(*) from phnDetails d group by d.phnName
and got output like this:
iphone 3
nokia 3
sony 1
Help me to retrieve only the max value.
I have the query working
Input
Working Query
Not sure if it is optimized however it is working as expected
Output as below,
Solved using the steps as below, If it answers your question please mark it as answered