The GROUP BY clause specifies one or more columns used to group rows returned by the query. Columns referenced in the SQL SELECT statement list, except for aggregate expressions, must be included in the GROUP BY clause. You cannot group by Memo, General, or Blob fields.
For the complete syntax, see SELECT - SQL Command.
The detailed syntax for the GROUP BY clause is as follows:
[GROUP BY Column_List_Item [, ...] ] |
Parameters
- Column_List_Item
- Specifies one or more columns used to group rows returned by the query.
Column_List_Item can be one of the following:
-
A field in a table in the FROM clause or a subquery.
-
A table alias from the SQL SELECT list.
-
A numeric expression indicating the location of the column in the result table. The leftmost column is number 1.
Remarks
The following code shows a summary of the main clauses of the SELECT - SQL Command:
В | Copy Code |
---|---|
SELECT Select_List FROM Table_List ...[WITH (BUFFERING = lExpr)] [WHERE Conditions] [GROUP BY Column_List] [HAVING Conditions] [UNION Clause] [ORDER BY Column_List] [INTO Clause | TO Clause ] [Additional_Display_Options] |
For more information about a particular clause of the SQL SELECT command, see the following topics: