Oracle Error Message
QSM-01060: illegal subquery in the HAVING clause
Reason for the Error
When a HAVING clause has a subquery, then any references to the tables in the outer query should only reference the tables in the GROUP BY clause.
Solution
Correct error in the syntax and rerun the query.