HAVING clause in SOQL is almost similar to
WHERE except that
HAVING allows you to filter using functions such as
Find all clinics where the total booking amount in the previous month exceeds 10000 USD.
Note how the
WHERE clause and
HAVING clause are used together in the above query.
WHERE clause applies a filter on the rows to retrieve, and then these rows will be aggregated. The
HAVING clause applies a filter on the aggregated rows returned finally.