Cannot use non-grouped column [sales_manager_name], expected []

What's wrong with this SQL syntax in ES:

SELECT sum(net_value), sales_manager_name FROM "sales*"

?

It generates error:

Whoops! Expression failed

Expression failed with the message:

[essql] > Unexpected error from Elasticsearch: [verification_exception] Found 1 problem(s) line 1:45: Cannot use non-grouped column [sales_manager_name], expected

This is right SQL syntax.

What are you expecting to get in the first and the second columns here?

In first number, second text.
I've mamaged this by adding GROUP BY; SELECT sum(net_value), sales_manager_name FROM "sales*" GROUP BY sales_manager_name
Original query has limited sense but is correct anyway :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.