hive -e "select a.EMP_ID,
count(distinct c.SERIAL_NBR) as NUM_CURRENT_EMP,
count(distinct c.SERIAL_NBR)/count(distinct a.SERIAL_NBR) as DISTINCT_EMP
from ORDERS_COMBINED_EMPLOYEES as a
inner join ORDERS_EMPLOYEE_STATS as b
on a.CPP_ID = b.CPP_ID
left join ( select SERIAL_NBR, MIN(TRAN_DT) as TRAN_DT
from EMP_TXNS
group by SERIAL_NBR
) c
on c.SERIAL_NBR = a.SERIAL_NBR
where c.TRAN_DT > a.LAST_TXN_DT
group by a.EMP_ID
having (
(NUM_CURRENT_EMP >= 25 and DISTINCT_EMP > 0.01)
) ; " > EMPLOYEE_ORDERS.txt
正在获取错误消息, "FAILED: SemanticException [Error 10025]: Line 15:31 Expression not in GROUP BY key '0.01'".
当我运行同一个查询时只有一个条件 HAVING
条款as NUM_CURRENT_EMP >= 25
,查询运行良好,没有任何问题。 NUM_CURRENT_EMP
是一个 int
类型和 DISTINCT_EMP
是 float
在我试图插入结果的表中。打断我的头。
感谢您的帮助。
1条答案
按热度按时间jk9hmnmh1#
如果替换
having
用定义它们的表达式?