Oracle Error QSM-02104: aggregate function in a filter condition in the HAVING clause

Oracle Error Message

QSM-02104: aggregate function in a filter condition in the HAVING clause

Reason for the Error

The capability in question is not supported when the materialized view references an aggregate function in a filter condition in the HAVING clause.

Solution

Re-phrase the query to avoid the use of aggregates in filter conditions in the HAVING clause.