Oracle Message QSM-01060 - illegal subquery in the HAVING clause

ERRORillegal subquery in the HAVING clause
CAUSEWhen 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.
ACTIONCorrect error in the syntax and rerun the query.