HAVING clause <name> without grouping or aggregation. (Error 3091)

This error occurs when the query evaluates the identifiers in the SELECT statement. The error occurs because a GROUP BY clause is not specified before the HAVING clause or because the column referenced in the HAVING clause is not in an AGGREGATE function. For example this error would occur with SELECT col1 FROM table1 HAVING col1 > 20. If the statement was changed to SELECT col1 FROM table1 GROUP BY col1 HAVING col1 > 20, then the statement would be valid. Alternatively, the following would be valid SELECT col1, count(col2) FROM table1 GROUP BY col1 HAVING count(col1) > 20.



Community Additions

Show: