I am trying to run the query below, it works fine in mysql server, yet the result says the following error message while running in Athena
"EXPRESSION_NOT_AGGREGATE: line 5:1: 'card_type' must be an aggregate expression or appear in GROUP BY clause"
Query :
SELECT SS.employee_id,
SUM(SS.net_salary),
card_type
FROM employee_summary SS
where card_type = 'xxx'
GROUP BY employee_id
Having SUM(SS.net_salary) > 10000
What I want to do is select the above columns, sorted by employee ID, and check if the net salary is greater than 10000, why should 'card_type' be aggregated or appear in GROUP BY clause?
Many thanks