Sorting a result set

You can sort on a field in ascending or descending order based on the field value. You can also specify the field sort order.

Before you begin

If you are using SQL Server, the sort order depends on how your SQL Server database has been installed (numeric versus dictionary, and whether case-sensitivity is enabled).

About this task

Use the Display editor in the Query window to sort the result-set records. You can sort on a field in ascending or descending order based on the field value. You can also specify the field sort order.

To use the Display editor to sort the records in a result set:

Procedure

  1. Click the Display editor tab in the Query window.
  2. In the Display Fields grid, select the cell in the Sort column that corresponds to the field on which you want to sort. Each time you click a cell in the Sort column, you toggle between sorting the result set on the corresponding field in ascending order, descending order, or no sort order (the cell is empty).
  3. Click the Sort Order cell of the corresponding field and enter the order in which you want this field sorted. For example, type 1 for the field that you want to be the primary sort field, type 2 for the secondary sort field, and so on.