CAML语法-Query写法

1.Geq(>=)
  The Geq element is an arithmetic operator that means "greater than or equal to." It can be used within a Where element in a view definition.
<Query>
  <Where>
    <Or>
      <IsNull>
        <FieldRef Name="Expires" />
      </IsNull>
      <Geq>
        <FieldRef Name="Expires" />
        <Value Type="DateTime">
          <Today />
        </Value>
      </Geq>
    </Or>
   </Where>
   <OrderBy>
   <FieldRef Name="Modified" Ascending="FALSE" />
  </OrderBy>
</Query>
2.Eq(=)
  The Eq element is an arithmetic operator that means "equal to" and is used within the Query element.
<Query>
  <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
  </OrderBy>
  <Where>
    <Or>
      <Eq>
        <FieldRef Name="Status"></FieldRef>
        <Value Type="Text">Completed</Value>
      </Eq>
      <IsNull>
        <FieldRef Name="Status"></FieldRef>
      </IsNull>
    </Or>
  </Where>
</Query>
3.Gt(>)
The Gt element is an arithmetic operator that means "greater than." This element is used similarly to Eq and Lt.
<Query>
  <Where>
    <Or>
      <IsNull>
        <FieldRef Name="Deadline" />
      </IsNull>
      <Gt>
        <FieldRef Name="Deadline" />
        <Value Type="DateTime">
          <Today />
        </Value>
      </Gt>
    </Or>
  </Where>
  <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE" />
  </OrderBy>
</Query>
4.Lt(<)
The Lt element is an arithmetic operator that means "less than" and is used in queries in views. This element is used similarly to Eq and Gt.
<Query>
  <Where>
    <Or>
      <IsNull>
        <FieldRef Name="Deadline" />
      </IsNull>
      <Lt>
        <FieldRef Name="Deadline" />
        <Value Type="DateTime">
          <Today />
        </Value>
      </Lt>
    </Or>
  </Where>
  <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE" />
  </OrderBy>
</Query>
5.Neq(!=)
The Neq element is an arithmetic operator that means "not equal to" and is used in queries.
<Query>
  <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
  </OrderBy>
  <Where>
    <Or>
      <Neq>
        <FieldRef Name="Status"></FieldRef>
        <Value Type="Text">Completed</Value>
      </Neq>
      <IsNull>
        <FieldRef Name="Status"></FieldRef>
      </IsNull>
     </Or>
   </Where>
</Query>
posted on 2007-08-17 12:09  山 前  阅读(2638)  评论(3编辑  收藏  举报