S02021

Error Code

S02021

Error Message

The HAVING clause after GROUP BY must be followed by a boolean expression. RefId:S02021

Probable Causes

This error occurs when the HAVING clause is not followed by a boolean expression.

For example:

n = 10000
id = take(1..10, n)
value = take(1..10, n)
t = table(id, value)

a = 1.0
select max(value) from t group by id having a // throw an exception
select max(value) from t group by id having value // throw an exception

Solutions

Ensure that the HAVING clause is followed by a boolean expression. The following query can be successfully executed:

select max(value) from t group by id having max(value) != 0