SQL: HAVING clause is invalid (Error 1803)

There is an error in the HAVING clause.

For example, the clause might not contain a logical expression. For more information, see SELECT - SQL.