Partager via


OrderBy Element (Query)

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Determines the sort order for a query. The OrderBy element contains a group of FieldRef elements.

<OrderBy>
  <FieldRef
    Ascending = "TRUE" | "FALSE"
    Name = "Text" />
    ...
</OrderBy>

Attributes

Attribute

Description

None

N/A

Child Elements

FieldRef

Parent Elements

Query

Occurrences

Minimum: 0

Maximum: 1

Remarks

The order in which the fields appear is the order in which the fields are sorted. The value of the Ascending attribute in the FieldRef element determines whether to sort in ascending order.

Example

The following example sorts the fields first in ascending order by the Newcomers field, then in descending order by Years, and finally in ascending order by Location.

<OrderBy>
  <FieldRef Name="Newcomers"/>
  <FieldRef Name="Years" Ascending="FALSE"/>
  <FieldRef Name="Location"/>
</OrderBy>