Sorting in CFQL
CFQL allows you to sort the loaded records by specifying the “ORDER BY” statement in your queries.
The order by syntax is pretty much the SQL syntax:
order by <identifier1> [asc | desc], <identifier2> [asc | desc], … , <identifierN> [asc | desc]
Note that identifiers can be expressions navigating your model such all:
load order by Customer.Reference
The expression orders all records of the declaring entity by the Reference of its related Customer (Customer is a relation property of the declaring entity).
Other than that, ASC and DESC keywords work exactly as in SQL.
Since the sort order is defined in a CFQL query, the generated stored procedure will always sort at run time using the specified column and direction (by the way if no direction is specified, ascending is used by default).