Grouping by column
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Grouping by column
The result set of a query may be ordered by
one or more columns specified in the GROUP BY clause.
Syntax
|
Notes
- For
the first column specified in the
GROUP BYclause, SQL arranges rows of the result table into groups whose rows all have the same values for the specified column. - If you specify a second
GROUP BYcolumn, SQL groups rows in each main group by values of the second column. - SQL groups rows for values in additional
GROUP BYcolumns in a similar fashion. - All columns named in the
GROUP BYclause must also be in the select list of the query expression. Conversely, columns in the select list must also be in theGROUP BYclause or be part of an aggregate function.
Example
This example retrieves name and order info for customers with orders:
|