Database Reference
In-Depth Information
The query results appear in Figure 3-46.
98
FIGURE 3-46
Query results
In this case, the row created for a group will be displayed only when the count of the number of records
in the group is less than four.
You can include both a WHERE clause and a HAVING clause in the same query design, as shown in
Figure 3-47.
WHERE clause
Only customers whose
balance is less than
$10,000 will be included
Only groups with fewer
than three records will
be included
HAVING clause
FIGURE 3-47
SQL query that includes WHERE and HAVING clauses
The query results appear in Figure 3-48.
FIGURE 3-48
Query results
In this case, the condition in the WHERE clause restricts the rows from the Customer table to those rows
in which the credit limit is less than $10,000. These rows are grouped by rep number. The HAVING clause
then restricts the groups to those for which the count of the rows in the group is less than three.
Search WWH ::




Custom Search