how to build caml query for following condition. All the fields all from single list.
select empid, ename, salary from emp where empid=(100 or 107 or 99 or 103 or 105) and deptno=10 and mgrId=23
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityhow to build caml query for following condition. All the fields all from single list.
select empid, ename, salary from emp where empid=(100 or 107 or 99 or 103 or 105) and deptno=10 and mgrId=23
Try below:
<View>
<ViewFields>
<FieldRef Name='empid'/>
<FieldRef Name='ename'/>
<FieldRef Name='salary'/>
</ViewFields>
<Query>
<Where>
<And>
<In>
<FieldRef Name='empid' />
<Values>
<Value Type='Integer'>100</Value>
<Value Type='Integer'>107</Value>
<Value Type='Integer'>99</Value>
<Value Type='Integer'>103</Value>
<Value Type='Integer'>105</Value>
</Values>
</In>
<And>
<Eq><FieldRef Name='deptno'/><Value Type='Integer'>10</Value></Eq>
<Eq><FieldRef Name='mgrId'/><Value Type='Integer'>23</Value></Eq>
</And>
</And>
</Where>
</Query>
</View>
Also you can see list of caml query builder tools . You can use any of these tools to further build more queries and test it.