查询不起作用。也许“分组依据”存在问题。怎么了?

时间:2019-07-17 09:31:44

标签: mysql hive hiveql

查询不起作用。怎么了?

配置查询:

create Table copy_table 
as select * from old_table as old
where column_A = 'ABC'
and column_B is null
and column_C = 'VAL'
group by column_D
order by column_E desc

错误消息:

Error while compiling statement: FAILED: SemanticException [Error 10025]: Expression not in GROUP BY key p_dt

1 个答案:

答案 0 :(得分:0)

所有列均应汇总或包含在group by中(如果未汇总)。然后选择所有列*,而group by中仅包含一列。

包括group by中的所有列,或使用min(),max()等聚合所有其他列。进行group by时,select中的所有列均应包括在聚合或group by中。 / p>