Group rows in the result set (GROUP BY clause)

You must select source tables for an SQL statement before you can select grouping columns.

The GROUP BY clause specifies that rows retrieved by the WHERE clause should be grouped and condensed in such a way that all rows having the same values for the grouping columns will be treated as a single row in the result set.

SQL Assist will automatically add all columns in the SELECT clause (other than column function columns) to the grouping column list if there are any column function columns in the SELECT clause.

These steps are part of the larger task of creating SELECT statements. When you complete the steps for grouping columns in the result set (GROUP BY clause), return to Create a SELECT statement.

To group rows in the result set:

  1. In the Outline view, click the GROUP BY node. A list of available columns is displayed in the Details area.
  2. In the Details area, select grouping columns from the Available columns list.
  3. Click > to move the selected columns to the Selected columns list. The grouping columns are added to the SQL statement.

Return to Create a SELECT statement.