Must be an aggregate expression or appear in GROUP BY clause

0

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

kor123
asked a year ago4177 views
1 Answer
0
profile pictureAWS
EXPERT
answered a year ago
profile picture
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions