The ORDER BY clause specifies
the order of the rows of a results
table for an SQL statement.
When a single
sort specification is identified, the rows are ordered
by the values of that sort specification.
You cannot use an
ORDER BY
clause on a SELECT statement within the FULLSELECT statement. The
ORDER BY
clause applies to the final result set from the FULLSELECT statement.
You
can sort on either a single column or multiple columns.
Prerequisites:- The FULLSELECT statement must be open in the SQL Query Builder.
- The tables must be specified for the FULLSELECT statement.
To create an ORDER BY clause for a single-column sort
in a FULLSELECT
statement in the SQL Query Builder:
- In
the Outline view, click either the root-node SELECT statement
or a UNION node that represents a subordinate FULLSELECT statement. The FULLSELECT editor pane is displayed in the SQL Query Builder.
- In the SQL Query Builder, double-click the first
cell under the Column heading
to open the list of available columns.
- Click
the column or enter the column expression on which you want
to sort.
- Double-click the Sort Type cell,
select
either Ascending, Descending,
or Default, and then press Enter. The
Default
option indicates that sorting is required, but no SQL source should
be shown
for the sort type. The default sort type for your database product
is used.
- Double-click the cell under the Sort
Order heading.
- Select the number
that corresponds to the order in which to sort
the results, and then press Enter.