You can add an ORDER BY clause to establish a sort
order for the query results. Perform the following steps to add an
ORDER BY clause to the SQL query in the
Designer window:
-
Click
Create in the Navigate pane to access the
Diagram tab and the SQL Clauses pane.
-
Double-click
Order by in the SQL Clauses pane. The
Order
by object is added to the query flow in the
Diagram tab.
-
Click
the
Order by object in the SQL Clauses pane
to access the
Order by tab.
-
Select
the column that you want to use for ordering the query results from
the
Available columns field. Then, move the
column to the
Order by columns field. Finally,
enter a value in the
Sort Order field to
determine whether the results are sorted in ascending or descending
order.
-
The following
display depicts a sample SQL query with an ORDER BY clause.
Sample SQL Query Sorted with an ORDER BY Clause
Note that
the ORDER BY column is set on the
Order by tab, and the resulting SQL code is highlighted on the
Code tab. To highlight the code for a query object,
right-click the object in the Navigate pane and click
Find In. Then, click
Code in
the submenu.