Skip to content
Advertisement

SYNTAX ERROR:GROUP BY clause cannot contain aggregations or window functions

I am unable to group by over the extracted value from other_detail(which can be 0 or 1 only) in AWS Athena. ‘other_detail’ is a JSON while order_date is of type date. Error:

GROUP BY clause cannot contain aggregations or window functions.

The query works fine when not using GROUP BY

Advertisement

Answer

A simple solution is to use a nested query:

BTW, did you mean to have count(distinct(order_date)) or any other date manipulation (day ?) on the order_date column?

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement