HAVING¶
The HAVING
clause is used for filtering with GROUP BY
.
HAVING
applies the filter after generating the groups, whereas
WHERE
applies the filter before generating any groups:
For example:
HAVING
statements also referring to columns by aliases used in
the GROUP BY
: