0

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
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.