配置单元获得的行超出平均值10000

时间:2018-10-27 15:01:30

标签: linux hive average

我正在尝试使用Hive来显示表中的行,该行超过每个唯一工作角色(ROLE)的平均薪水(AnnualSalary)超过10000。 我尝试使用下面的代码无效,并在底部显示错误

hive> SELECT ROLE, AVG(AnnualSalary) From Salaries WHERE AnnualSalary > AVG(AnnualSalary) +10000   GROUP BY ROLE;
  

失败:SemanticException [错误10128]:行1:66 UDAF'AVG'尚不支持的位置

1 个答案:

答案 0 :(得分:0)

Having Clause

SELECT ROLE, AVG(AnnualSalary) 
FROM Salaries 
GROUP BY ROLE
HAVING AnnualSalary > (AVG(AnnualSalary) + 10000);