The HAVING clause is used to specify a filtering condition on groups created by the GROUP BY clause.
dbForge Query Builder for SQL Server allows you to create the HAVING clause in the SELECT and INSERT INTO statements.
To work with HAVING clauses, open the Tabbed Editor by clicking Show Tabbed Editor on the Query toolbar or Query menu.
The Having tab of the Tabbed Editor displays the HAVING clause as a tree with the condition and condition groups. A group consists of several conditions or subgroups, combined with a logical operator.
You can use arrow keys for navigation:
The guide covers how to:
1. On the Having tab, use one of the following ways to add a new condition:
2. In a new HAVING syntax construction that opens, do the following:
Click the upper-level operator to filter records grouped by:
3. Switch to the Text view to preview the SELECT statement with the specified HAVING clause.
You can create, modify, or remove groups and conditions in the HAVING clause.
To create a new group
1. On the Having tab, open the group construction by using one of the following ways:
2. Click the upper-level operator to select the operator for the group
3. Click enter a value to set the conditions to be provided in the HAVING clause.
4. Click the condition criteria operator and select the criteria operator you want from the list.
5. If the condition operator requires operand values, specify them.
6. Switch to the Text view to check the result.
To remove a condition, click Remove Condition or navigate to condition and press the DELETE or MINUS SIGN keys.
To remove a group, use one of the following ways:
To remove all conditions and groups, click the upper-level operator and select CLear All.
You also can copy, cut, and paste conditions and groups with CTRL+C, CTRL+X, and CTRL+V keys.