Sorting the result set

Use the Order page to specify the order of rows in the result set. You specify the order by identifying one or more columns to be used as sort columns. You can specify multiple sort columns.

../rule.gif

To sort the result set:

  1. Select one or more columns from the Available columns list. You can expand or collapse a table to display or hide the columns that are included in that table.

    Because the Display output columns only radio button is selected, the Available columns list is limited to those columns that are shown in the Selected columns list on the Columns page. You can display all of the columns in all the tables that are specified in the Selected tables list on the Tables page, and any column expressions that are specified on the Columns page, by clicking the Display all available columns radio button.

    If the Exclude duplicate rows (SELECT DISTINCT) checkbox is selected on the Conditions page, you cannot select the Display all available columns radio button on the Order page. The Available columns list is limited to those columns that are shown in the Selected columns list on the Columns page.

  2. Click > to add the columns to the Selected columns list. If you want to add all of the columns from all of the tables in the Available columns list to the Selected columns list, click >>.

    To remove one or more columns from the Selected columns list, click on the columns, then click <. To remove all of the columns from the Selected columns list, click <<.

  3. Select the order by which to sort the result set. If you select Ascending (up arrow), the result set is ordered in ascending order by values in the selected columns. If you select Descending (down arrow), the result set is ordered in descending order by values in the selected columns.

The rows of the result set are ordered by the values in the sort columns. If you specify multiple sort columns, the rows of the result set are ordered by the values in the first sort column, then by the values in the second sort column, and so on. To change the order of the sort columns, click on a column name, then click Move Up or Move Down.

../rule.gif

Related information

Order page - Fields and controls

Specifying the tables for an SQL statement

Specifying result columns

Joining tables

Specifying search conditions for rows

Grouping rows and specifying search conditions for groups

Verifying the SQL statement

Completing your SQL statement

Inserting column values

Updating column values

Remapping data to another SQL data type

Creating SQL statements with SQL Assist

Logging on to SQL Assist

Selecting the type of SQL statement to create