SOQL HAVING
The HAVING
clause in SOQL is almost similar to WHERE
except that HAVING
allows you to filter using functions such as SUM
, COUNT
, AVG
, MIN
or MAX
.
Example:
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.
The 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.