Creating GROUP BY clauses in the SQL builder

The GROUP BY clause contains a grouping expression that is used to define the grouping of the result set of the previous clause of the SELECT statement. A GROUP BY clause creates a set of rows. Each row in the results table represents the set of rows for which the grouping expression is equal.

SQL support for grouping in the SQL builder is dependent on the level of support that is provided by your database vendor. There might be variations in syntax depending upon the database vendor that you are using. If you use the SQL builder to create the GROUP BY clause, the tool attempts to create the correct syntax for the database vendor that you are using.

See the documentation for your database product for more information about grouping.

Prerequisite: The SELECT statement must be open in the SQL builder.

To create a GROUP BY clause in the SQL builder:

  1. In the Design pane of the SQL builder, click the Groups tab.
  2. On the Groups page, click Grouping root in the list. The list shows the grouping expression that is currently defined. Initially, this list contains only Grouping root.
  3. To add to the Grouping root, double-click the first empty row under Column.
  4. In the cell, select a column, build an expression, or select a grouping type from the list. Selecting a column or specifying an expression defines the aspect of the result set that is evaluated to determine the grouping. By selecting a grouping type, you are nesting a grouping clause.
  5. To modify a nested grouping type, select the type in the grouping expression list, and then complete the details for that grouping type. You can add columns, expressions, and groups to the grouping type in the Columns list
  6. Optional: To modify the grouping type, select the grouping type from the Grouping root field, and then select a type from the Type list.
  7. Optional: To narrow the expression that is evaluated to group the result set, define conditions for the grouping set.
Related tasks
Creating expressions in the Expression Builder wizard
Related reference
Groups page

Feedback