Redigera

Dela via


Sort with ORDER BY (Visual Database Tools)

Applies to: SQL Server

You can sort query results by one or more of the columns in the returned rows by using an ORDER BY clause. You can define an ORDER BY clause by choosing options in the Criteria Details pane.

To sort a query using an ORDER BY clause

  1. Open a query or create a new one.

  2. In the Criteria Pane, click the Sort Type column for the row corresponding to the column that you want to use to sort your query results.

  3. Choose Ascending or Descending from the drop-down list.

Note

Clearing the Sort Type entry for a column removes that column from the ORDER BY clause.

Notice that as you work in the Criteria pane, your query's UNION clause changes to match your most recent actions.

Note

When sorting results by more than one column, specify the order in which columns are searched relative to each other by using the Sort Order column. For more information, see How to: Sort Multiple Columns in Queries.

See Also

Sort and Group Query Results (Visual Database Tools)
Summarize Query Results (Visual Database Tools)
Design Queries and Views How-to Topics (Visual Database Tools)