I saw a few threads here with similar questions however I couldn\'t find something fitting my needs.
Consider the following table and example data:
CRE
try it with the "having" clause!
SELECT a, SUM(b) FROM foo GROUP BY a having sum(b) > 9;
You can't use aggregate expression in the where clause - this is what the having clause is for:
where
having
SELECT a, SUM(b) FROM foo GROUP BY a HAVING SUM(b) > 9