Collation Order in a GROUP BY Clause (Embedded SQL Guide)

From InterBase
Jump to: navigation, search

Go Up to Grouping Rows with GROUP BY


When CHAR or VARCHAR columns are grouped in a SELECT statement, it can be necessary to specify a collation order for the grouping, especially if columns used for grouping use different collation orders.

To specify the collation order to use for grouping columns in the GROUP BY clause, include a COLLATE clause after the column name. For example, in the following GROUP BY clause, the collation order for two columns is specified:

. . .
GROUP BY LNAME COLLATE FR_CA, FNAME COLLATE FR_CA;

For more information about collation order and a list of collation orders available in InterBase, see the Data Definition Guide.