Specifying Collation Order in an ORDER BY Clause

From InterBase
Jump to: navigation, search

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

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

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

For the complete syntax of the ORDER BY clause, see the Language Reference Guide.