Design conditions for HAVING clauses

A HAVING clause filters the results of a GROUP BY clause.

You can create HAVING clauses in the SELECT and INSERT INTO statements using the Having tab of Tabbed Editor.

Open Tabbed Editor

To open Tabbed Editor, do one of the following:

  • In the top menu, select Query > Show Tabbed Editor.

  • On the Query toolbar, click Show Tabbed Editor.

The Having tab of Tabbed Editor shows the HAVING clause as a tree structure with conditions and condition groups. Each group can include multiple conditions or nested groups connected by logical operators.

Create a HAVING clause

1. Go to the Having tab in Tabbed Editor.

2. To add a filter condition, do one of the following:

  • Click Add a new condition for the current group.

  • Select the upper-level group operator, then select Add Condition.

3. In the filter condition template that appears:

  • Choose a logical operator:

    • AND – Returns records when all conditions are true.
    • OR – Returns records when at least one condition is true.
    • NOT (AND/OR) – Reverses the logic of the specified condition group.
  • Click the enter a value placeholder and choose a column or enter a constant.

  • Select the filter operator, such as =, <, or <>.

  • Click the enter a value placeholder and complete the condition with a column or constant.

A list of supported comparison operators in the HAVING clause

4. Optional: To preview the query, click Text in the bottom panel of the Query Builder document.

Work with HAVING conditions and condition groups

You can create, modify, or remove groups and conditions in a HAVING clause.

Create a condition group

1. Do one of the following to insert a new group:

  • Click Add a new group .

  • Select the upper-level group operator, then select Add Group.

  • Press Ctrl+Plus Sign.

2. Choose the logical operator for the group, for example, AND, OR, or NOT.

3. Click the enter a value placeholder and choose a column or specify a constant.

4. Choose a comparison operator from the list.

5. If required, specify the operand value.

6. Optional: To preview the query, click Text in the bottom panel of the Query Builder document.

Remove a condition

To remove a condition, click Remove condition.

Alternatively, navigate to the condition and press Delete or Minus Sign.

Remove a group

To remove a group, do one of the following:

  • Click Remove group icon for the group you want to remove.

  • Click its logical operator and select Remove Group on the shortcut menu.

  • Navigate to the group and press Delete or Minus Sign.

Remove all conditions and groups

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 using Ctrl+C, Ctrl+X, and Ctrl+V, respectively.

Navigate between conditions and condition groups

To navigate between conditions and condition groups, do the following:

  • Use Up Arrow, Down Arrow, Left Arrow, and Right Arrow to navigate between conditions and groups.

  • Use Left Arrow and Right Arrow to navigate between criteria operator and operands.