Grouping output fields

To setup grouping by some of the fields and/or to define aggregate functions on grouped rows you may use the Group by column.

 

You may select one of the following values for this column from the drop-down list:

 

  • Expression and Where: These values are used when no grouping is specified. Expression is set when this expression is used as an output expression in the SELECT clause and nothing else. Where is set automatically when you define a criterion to this expression that results in including this expression to the WHERE clause. Normally you shouldn't care about the value of the Group By column when you don't want to define grouping.  

  • Group by and Having: These values are similar to Expression and Where, but used when you want to define grouping in your query. In this case, you should set Group by for all columns you want to group by. Specifying criteria for the grouped columns will include these criteria in the HAVING clause. If you want to include an expression ONLY in the HAVING clause you should set the Having value in the Group By column for this expression.  

  • Aggregate functions (Count, Sum, etc): By selecting one of these values, you will create an aggregate expression for the value indicated in the Expression column.

  

Grouping output fields