You can use Having clause to perform this. If you examine the flow of SQL query execution:
1. From clause.
2. where clause.
3. Group By clause.
4. Having clause.
Having clause is computed after group by clause. So, you can use aggregate function in Having clause to check the condition.