How to join two sharepoint list in c# by CAML query?
I have created two list Markmaster and StudentMaster, both are connected with a lookup column(StudentID). I need to fetch data from both the list. List Detail are StudentMaster List Column are ID, Name, Class, SEction, RoleNumber MarksMaster List Column are ID, Title, ScienceGroup, ArtGroup, CommerceGroup, StudentID(Lookup)
Below is the code FYI, SPList customerList = Oweb.Lists["MarksMaster"]; query.Query = @"null";
query.Joins = @"<Join Type='Left' ListAlias='StudentMaster'> <Eq> <FieldRef Name='StudentID' RefType='ID'/> <FieldRef List='MarksMaster' Name='ID'/> </Eq> </Join>"; query.ProjectedFields = @"<field Name='StudentName' Type='Lookup' List='MarksMaster' ShowField='Title'/> <field Name='StudentSection' Type='Lookup' List='MarksMaster' ShowField='Section'/> "; query.ViewFields = @"<FieldRef Name='StudentSection'/> <FieldRef Name='ScienceGroup'/>";
When am try to join the both list using above caml join query.
Value does not fall within the expected range.