Share via


Where Element

Within the Query element, the Where element is used to specify a filter for the view.

Syntax

<Where>
</Where>

Element Relationships

Parent Elements Child Elements
Query And, BeginsWith, Contains, Eq, Geq, Gt, IsNotNull, IsNull, Leq, Lt, Neq, Or

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/time value in the Expires field is greater than today's date/time.

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