You can specify filter conditions for data that is grouped. For example, if order records are grouped by customer, you can select only customers whose order totals exceed $150000. The filter condition for a group is specified using the HAVING clause. This clause behaves like the WHERE clause, but is applicable to groups. The WHERE clause, on the other hand, applies to individual rows.
A SELECT statement can contain both WHERE and HAVING clauses. For example, you can select customers whose order totals exceed $150000, factoring only orders placed after 06/30/2004. The SELECT statement would look like the following: