Try OpenEdge Now
skip to main content
SQL Reference
SQL Reference : OpenEdge SQL Statements : SELECT : GROUP BY clause : Grouping by expression
 
Grouping by expression
The GROUP BY clause orders the result set according to an expression used in the SELECT statement.

Syntax

GROUP BY [expression]...

Notes

The GROUP BY clause can contain any scalar expression which produces a value that is used as a grouping key. An individual column, when it is part of a larger expression in a GROUP BY list, cannot by itself be referenced in the SELECT list. Only the entire expression, which is the grouping key, can be used in the statement's SELECT list. Note that a GROUP BY expression cannot contain an aggregate expression such as SUM.
The GROUP BY clause does not support set differencing operations such as MINUS and INTERSECT.

Example

In the following example, the GROUP BY clause refers to the concatenation expression used in the SELECT statement:
SELECT CONCAT (State, City),
       COUNT (city)
  FROM Pub.Customer
  GROUP BY CONCAT (State, City);