Oracle Error QSM-02022: aggregate selections

Oracle Error Message

QSM-02022: aggregate selections

Reason for the Error

The capability in question is not supported when the materialized view uses an aggregate expression in the HAVING clause.

Solution

Re-phrase the query to avoid the use of an aggregate in the HAVING clause.