Use this tab if you want to group rows in the result set.
Available columns – This box lists all the tables you have chosen 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.
Expression Editor – Click the Calculator icon, 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 the 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 the 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 the result sets of queries with GROUP BY clauses.
GROUPING SETS check box – Enable this check box to add GROUPING SETS to a query.
Results – Click the Results tab at the bottom of the dialog 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 dialog to see the SQL code for your query.
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.
For more information, see Introducing the Query Editor.