Grouping Output Fields

To build a query with grouping, mark expressions for grouping with the Grouping check box.

A query with grouping may have only grouping or aggregate expressions in the SELECT list. Thus the query builder allows you to set the Output check box for grouping and aggregate expressions. If you try to set this check box for a column without the grouping or aggregate function set, a Grouping check box will be set automatically to maintain the resulting SQL query's validity.

When the Apply Operations option contains columns marked with the Grouping check box, a new column called Criteria for appears in the grid. This column applies criteria to expression groups or their values.

Example

You have a column "Quantity" with Aggregate function "Avg" in your query, and you type > 10 in the Criteria column.

Having the "For groups" value set in the Criteria for column, the resulting query will contain only groups with an average quantity greater than 10, and your query will have the "Avg(Quantity) > 10" condition in a HAVING clause.

Having the "For values" value set in the Criteria for column, the resulting query will calculate the average aggregate function only for records with a quantity value greater than 10, and your query will have the "Quantity > 10" condition in WHERE clause.