Query Element (Query)
Defines the query for a view.
<Query>
<Where>
...
</Where>
<GroupBy>
...
</GroupBy>
<OrderBy>
...
</OrderBy>
</Query>
Different notations
The where clause of the query is defined using prefix notation, meaning the operator comes in front of both operands. i.e. operator operand1 operand2, so "and var1 = value1 var2 = value2"
Infix notation is what most English speakers are used to. i.e. operand1 operator operand2, so "var1 = value1 and var2 = value2"
Finally postfix notation would be like the HP calculator. i.e. operand1 operand2 operator, so "var1 = value1 var2 = value2 and"
- 5/3/2011
- Ralph Flora
Understanding CAML Query
Think of it as reverse polish logic, remember the HP calculators where you entered 4, 5, + and the answer was 9.
enter variable1, value1, eq, variable2, value2, eq, and, where, now reverse the order
to get
<where>
<and>
<eq> variable1, value1 </eq>
<eq> variable2, value2 </eq>
</and>
</where>
which is equal to
select * from list
where variable1 = value1 and variable2 = value2
enter variable1, value1, eq, variable2, value2, eq, and, where, now reverse the order
to get
<where>
<and>
<eq> variable1, value1 </eq>
<eq> variable2, value2 </eq>
</and>
</where>
which is equal to
select * from list
where variable1 = value1 and variable2 = value2
- 3/19/2009
- Mel Pama
- 10/2/2009
- S.B.Rogers