我在hive中尝试了以下查询。我收到错误"无法识别谓词' group'。失败的规则:'标识符'在子查询源"。
根据我的理解,我不确定该错误在下面的查询中意味着什么。任何建议都会很棒!!
select val1, val2, count(distinct(val3)) from (
select val1, val2, val3
from tab1
where (val1 in ('A', 'B')
or val2 in ('C', 'D')))
group by val1, val2
答案 0 :(得分:12)
您必须为子查询设置别名:
select val1, val2, count(distinct(val3)) from (
select val1, val2, val3
from tab1
where (val1 in ('A', 'B')
or val2 in ('C', 'D'))) as t
group by val1, val2