Progress
SQL-92
Guide and Reference
ORDER BY Clause
Allows ordering of the rows selected by the SELECT statement. Unless an ORDER BY clause is specified, the rows of the result set might be returned in an unpredictable order as determined by the access paths chosen and other decisions made by the query optimizer. The decisions made will be affected by the statistics generated from table and index data examined by the UPDATE STATISTICS command.
SYNTAX
expr
Expression of one or more columns of the tables specified in the FROM clause of the SELECT statement.
posn
Integer column position of the columns selected by the SELECT statement.
ASC | DESC
Indicates whether to order by ascending order (
EXAMPLESASC
) or descending order. The default isASC
.
NOTES
- The ORDER BY clause, if specified, should follow all other clauses of the SELECT statement.
- The selected rows are ordered on the basis of the first expr or posn. If the values are the same, then the second expr or posn is used in the ordering.
- A query expression can be followed by an optional ORDER BY clause. If the query expression contains set operators, then the ORDER BY clause can specify only the positions.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |