Sorting Your Output

Order By Columns

You can specify the order in which you want the output sorted. In this example, you use the query from the last example and change the ordering sequence of the columns in the Output window. From the SQL QUERY COLUMNS window, select Viewthen selectOrder By.
ORDER BY COLUMNS window
Move Before
displays all columns in the Order By Columns list except the currently chosen one. The currently chosen column will be inserted before the column that you select.
Move After
displays all the columns in the Order By Columns list except the currently chosen one. The currently chosen column will be inserted following the column that you select.
Ascending Order
changes the ordering sequence of the selected column's values to ascending (lowest value to highest value).
Descending Order
changes the ordering sequence of the selected column's values to descending.
Build a Column
displays the Build a Column Expression window, which enables you to create a calculated column for use in sorting your output. Use the Build a Column Expression window to create new columns by performing calculations on existing (numeric) columns.
Select BEGDATE from the Available Columns list. Select the right arrow to move the column to the Order By Columns list. By default, columns are sorted in ascending order, so the abbreviation ASC appears next to the column name in the Order By Columns list. Select BEGDATE ASC and Descending Order to change the ordering sequence.
Ordering in descending order by BEGDATE
Select Salary and JOBCODE, and move them to the Order By Columns list.

Move Columns

Select Salary ASC from the Order By Columns list and select Move Before. The Move Columns window appears.
Move Columns window
Select BEGDATE and OK. The ORDER BY COLUMNS window appears with Salary first in the Order By Columns list.
ORDER BY COLUMNS window
Select OK to return to the SQL QUERY COLUMNS window.
Select Viewthen selectWhere Conditions for Subset.
The WHERE EXPRESSION window appears. Select Undo four times, until only SALARY LT $18,000 is displayed.
Using the WHERE EXPRESSION window's Undo feature
Select OK.

Viewing Your Output

To run your query and view the output in the Output window, select Toolsthen selectRun Querythen selectRun Immediate.
Query output