Hive vertion:apache-hive-2.3.0
hive> select TAG_EMOTION_KEY AS key,count(1) AS cnn from NB_ORDER_RATE_EMOTION t where t.cnn>10 group by TAG_EMOTION_KEY ;
FAILED: SemanticException [Error 10002]: Line 1:84 Invalid column reference 'cnn'
原因是什么?
答案 0 :(得分:0)
您基本上试图获取出现超过10的TAG_EMOTION_KEY
列表。为此,您需要使用HAVING
而不是WHERE
子句。
像:
select
TAG_EMOTION_KEY AS key,
count(1) AS cnn
from
NB_ORDER_RATE_EMOTION t
group by
TAG_EMOTION_KEY
having
count(1) > 10
;
以下问题提供了HAVING
& WHERE
条款:SQL - having VS where