This topic has not yet been rated - Rate this topic

Where Element (Query)

Published: May 2010

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


<Where>
</Where>

Attribute

Description

None

N/A

Minimum: 0

Maximum: 1

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 (CAML) constants.

Fields referenced in a Where element do not have to be fields of the primary list that is being queried. If a foreign list is being joined, then fields from the foreign list can be itemized in a ProjectedFields element and can then be referenced in the Where element.

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>

Date

Description

Reason

May 2010

Initial publication

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
How to refernce projectedfields from foreign list in where element
Could anybody please explain me by example how to reference fields from the foreign list in a ProjectedFields element and How can I referenced in the Where element???