Why Max is throwing in below query in hive for alias?

0 votes

Below query is perfect and is working with other databases. When this query is run then it is throwing error in input to Max is not recognized. When this query is ran individually then it is working.

SELECT country, COUNT(country)

FROM airports GROUP BY country

HAVING COUNT (country)=(
SELECT MAX(mycount)

FROM (
SELECT country, COUNT(country) as mycount

FROM airports
GROUP BY country));
6 days ago in Big Data Hadoop by Amitdeb
• 120 points
17 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Hi,

You can do one thing, just enclose column name with back tick. Check it works or not.

SELECT `country`, COUNT(`country`) FROM airports GROUP BY `country` HAVING COUNT (`country`)=(SELECT MAX(`mycount`) FROM (SELECT `country`, COUNT(`country`) as `mycount` FROM airports GROUP BY `country`));

answered 6 days ago by reshma

Related Questions In Big Data Hadoop

0 votes
1 answer

How Impala is fast compared to Hive in terms of query response?

Impala provides faster response as it uses MPP(massively ...READ MORE

answered Mar 21, 2018 in Big Data Hadoop by nitinrawat895
• 9,030 points
173 views
0 votes
1 answer

Why is Hive not good for OLTP?

Apache Hive is mainly used for batch processing i.e. ...READ MORE

answered Jan 7 in Big Data Hadoop by Omkar
• 65,850 points
178 views
0 votes
1 answer

Why CREATE EXTERNAL keyword is used in Hive?

Hey, The create external keyword is used to create a ...READ MORE

answered May 15 in Big Data Hadoop by Gitika
• 7,580 points
7 views
0 votes
1 answer

What is the syntax for creating bucketing table in hive?

Hi, Syntax for creating bucketed table is as ...READ MORE

answered 6 days ago in Big Data Hadoop by Gitika
• 7,580 points
10 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 9,030 points
1,657 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 9,030 points
130 views
0 votes
10 answers

hadoop fs -put command?

copy command can be used to copy files ...READ MORE

answered Dec 7, 2018 in Big Data Hadoop by Sujay
8,040 views
0 votes
1 answer

Hadoop dfs -ls command?

In your case there is no difference ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by kurt_cobain
• 9,260 points
560 views
0 votes
1 answer

Hadoop Hive: Not recognizing alias named in select part?

The where clause is evaluated before the select clause, which is ...READ MORE

answered Nov 13, 2018 in Big Data Hadoop by Omkar
• 65,850 points
463 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.