Perform the following steps to add a HAVING clause
to the SQL query in the Diagram tab in the Designer window:
-
Click Create in the Navigate pane to access the Diagram tab and the SQL Clauses pane.
-
Double-click Having in the SQL Clauses pane. The Having object is added to the query flow on the Diagram tab.
-
Click Having in the Navigate pane to access the Having tab.
-
Click New on the Having tab to begin
the first condition of the expression. An editable row appears in
the table near the top of the tab.
-
Enter
the appropriate operands and operator for the first condition.
-
Add the
remaining conditions for the HAVING clause. You need to add one row
for each condition.
-
The condition
that is created for the sample query is depicted in the SQL code generated
in this step in the SQL field, as shown in
the following display.
Note that
the SQL code for the HAVING clause that is shown in the SQL field is identical to the highlighted HAVING clause
code that is displayed on the Code tab. (To
highlight the code for a query object, right-click the object in the
Navigate pane and click Find In. Then, click Code in the submenu.) The HAVING clause subsets the
groups that are included in the results for the query. In the sample,
only the regions with an average population density of less than 100
are included in the query results.