ORDER BY

Log Parser

ORDER BY

<order_by_clause> ::= ORDER BY <field_expr_list> [ ASC | DESC ]
<field_expr_list> ::= <field_expr> [ , <field_expr> ... ]

The ORDER BY clause specifies which SELECT clause field-expressions the query output records should be sorted by.


Arguments:

ASC

Specifies that the field-expression list values should be sorted in ascending order, from lowest value to highest value. ASC is the default.

DESC

Specifies that the field-expression list values should be sorted in descending order, from highest value to lowest value.


Remarks:

  • The Log Parser SQL-Like language requires that each field-expression appearing in the ORDER BY clause must also appear in the SELECT clause.
  • Differently than the standard SQL language, in the Log Parser SQL-Like language the DESC or ASC sort direction applies to all the field-expressions in the ORDER BY clause. In other words, it is not possible to specify different sort directions for different field-expressions.
  • NULL values are treated as the lowest possible values.


Examples:

A. Sorting by a single field-expression

SELECT date, cs-uri-stem, cs-uri-query, sc-bytes
FROM LogFiles\ex040528.log
ORDER BY sc-bytes DESC

B. Sorting by multiple field-expressions

SELECT date, cs-uri-stem, cs-uri-query, sc-bytes
FROM LogFiles\ex040528.log
ORDER BY date, sc-bytes


See also:

Field Expressions
SELECT

Sorting Output Records


© 2004 Microsoft Corporation. All rights reserved.