GROUP BY tab

Use this tab if you want to group rows in the result set.

Components

Available columns   This box lists all the tables you chose for your query, and the columns in each table.

GROUP BY columns   To group by a column, select a column or set of columns in the Available Columns box and click the Right Arrow. To delete a column, select it in the GROUP BY Columns box and click the Left Arrow. Use the Up and Down Arrows to scroll through the columns in the GROUP BY Columns box.

Add a Computed Column   Click the Add a Computed Column button, located between the Right and Left Arrows, to open the Expression Editor and build your GROUP BY condition.

CUBE button   Click this button to create a CUBE operation query. CUBE adds subtotal rows into result sets of queries with GROUP BY clauses, providing all possible combinations of the variables specified in the query.

ROLLUP button   Click this button to create a ROLLUP operation query. ROLLUP adds subtotal rows into result sets of queries with GROUP BY clauses.

Set button   Click this button to create a concatenated grouping sets operation query. Like ROLLUP and CUBE, this operation adds subtotal rows into result sets of queries with GROUP BY clauses.

GROUPING SETS   Select this option to add GROUPING SETS to a query.

Results   Click the Results tab at the bottom of the window to see the results of your query, or an error message if the query contains errors.

SQL   Click the SQL tab at the bottom of the window to see the SQL code for your query.

About GROUP BY conditions

You can group by columns, alias names, or functions. The result of the query contains one row for each distinct set of values in the named columns, aliases, or functions. All null-containing rows are treated as a single set. The resulting rows are often referred to as groups since there is one row in the result for each group of rows from the table list. Aggregate functions can then be applied to these groups to get meaningful results.

When GROUP BY is used, the Columns tab, HAVING tab, and ORDER BY tab must not reference any identifier that is not named in the GROUP BY tab. The exception is that the Columns tab and HAVING tab may contain aggregate functions.

See also