To build a query with grouping, you mark expressions for grouping with the Grouping checkbox.


A query with grouping must have only grouping or aggregate expressions in the SELECT list. Thus SQL Query Builder allows to set the Output checkbox for grouping and aggregate expressions. If you try to set this checkbox for a column without Grouping or Aggregate function set, a Grouping checkbox will be set automatically to maintain validity of result SQL query.


When Columns Pane contains columns marked with the Grouping checkbox, a new column called "Criteria for" appears in the grid. This column specifies appliance of criteria to expression groups or to their values.


For example, you have a column "Quantity" with Aggregate function "Avg" in your query and you type the "> 10" in Criteria column. Having the "for groups" value set in the Criteria for column, the result query will contain only groups with average quantity greater than 10, and your query will have the "Avg(Quantity) > 10" condition in HAVING clause. Having the "for values" value set in the Criteria for column, the result query will calculate the Average aggregate function only for records with Quantity value greater than 10, and your query will have the "Quantity > 10" condition in WHERE clause.


Defining grouping


TradiumTech.nl is voor de technische ondersteuning van Tradium Business Software, kijk op www.tradium.nl voor meer informatie.