Telerik OpenAccess Classic

Telerik OpenAccess ORM Send comments on this topic.
The ORDER BY Clause
See Also
Programmer's Guide > OpenAccess ORM Classic (Old API) > Telerik OpenAccess ORM OQL Reference > OQL - Object Query Language > The ORDER BY Clause

Glossary Item Box

This documentation article is a legacy resource describing the functionality of the deprecated OpenAccess Classic only. The contemporary documentation of Telerik OpenAccess ORM is available here.

The ORDER BY clause specifies the sorting sequence used for the result-set. The sequence is specified as a list of members of the extents used in the FROM clause. You can specify whether the query uses ascending or descending order by using the keywords ASC or DESC respectively. If you do not specify the order, the default value is ascending. The first member name listed is the primary sequence. Additional member names, if used, specify secondary sort sequences. Specifying an ORDER BY clause may adversely affect the performance of a query. Extents can be indexed to optimize orderings that you often use.

The ORDER BY keywords are as follows:

  • ASC - ascending sort order
  • DESC - descending sort order 

The following example query uses the ORDER BY clause:

OQL Copy Code
SELECT *  FROM ProductExtent AS product    ORDER BY product.unitPrice ASC, product.productName DESC

In the above example query, the result-set is first sorted by unit price in ascending order (primary sort order), then by name in descending order (secondary sort order). 

See Also