Share via


Where 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.

Used within the context of a query to specify a filter.

<Where>
</Where>

Attributes

Attribute

Description

None

N/A

Child Elements

And, BeginsWith, Contains, DateRangesOverlap, Eq, Geq, Gt, IsNotNull, IsNull, Leq, Lt, Membership, Neq, Or

Parent Elements

Query

Occurrences

Minimum: 0

Maximum: 1

Remarks

The Where clause translates into the SQL SELECT statement. The format of the Where clause is a structured XML tree with a mixture of comparison operators, simple arithmetic operators, field (column) references, constant values, and predefined (Collaborative Application Markup Language, or CAML) constants.

Example

In the following example, the Where element uses the Geq element as the filter in the query, returning cases where the date and time value in the Expires field is greater than today's date and time.

<Query>
  <Where>
    <Geq>
      <FieldRef Name="Expires"/>
      <Value Type="DateTime">
        <Today/>
      </Value>
    </Geq>
  </Where>
  <OrderBy>
    <FieldRef Name="Modified"/>
  </OrderBy>
</Query>