Ordering Query Results

Visual Database Tools

Visual Database Tools

Ordering Query Results

You can order your query by the contents of a data column or by an expression. The Query Designer allows you to specify the sort types ascending and descending.

You can also order the query results by more than one column or expression and specify the sort order for each. For example, if you are querying an employee table, you can order the results by department (sort order = 1) and within each department by last name (sort order = 2).

Note   You cannot sort by the contents of a memo or binary (BLOB) column.

To order query results

  1. If you have not done so already, add the columns or expressions that you want to sort by to the Grid pane.
    If you do not want the columns or expressions to be part of the result set, remove them as output columns.

  2. In the Grid pane, locate the row containing the first data column or expression to sort by, and then in the Sort Type grid column, choose Ascending or Descending.

  1. If you are sorting by multiple columns or expressions, specify the sort order in the Sort Order column of the grid.

–or–

  • In the Diagram pane, right-click the column to sort by and then choose Sort Ascending or Sort Descending from the shortcut menu. You can select multiple columns before right-clicking them. If you use this method, the columns are sorted in the order you select them.

See Also

Collapsing Groups of Rows