To complement a GROUP BY clause, use a HAVING clause to apply one or
more qualifying conditions to groups after they are formed. The effect of the HAVING clause on groups is similar to the way the WHERE clause qualifies individual rows. One advantage of using a HAVING clause is that you can include aggregates in the search condition, whereas you cannot include aggregates in the search condition of a WHERE clause.
Each HAVING condition compares one column or aggregate expression of
the group with another aggregate expression of the group or with a constant. You can use HAVING to place conditions on both column values and aggregate values in the group list. Demo Database Below is a selection from the "Orders" table in the Northwind sample database: And a selection from the "Employees" table: The following SQL statement lists the employees that have registered more than 10 orders: The following SQL statement lists if the employees "Davolio" or "Fuller" have registered more than 25 orders: