SP10
SP10

Reputation: 91

CAML JOINS using SharePoint

Assume that there are Emp and Dept tables.

Emp Table has

EmpID
FirstName
LastName
DeptName
Email

Dept table has

DeptID
DeptName

i have to display all the employee details based on DeptName using CAML query. Can some one share CAML JOINS example for this scenario.

Thank you

Upvotes: 1

Views: 5293

Answers (2)

murat
murat

Reputation: 21

Check this approach very easy to join as many list as you want: Link

cawl_QueryBuilder cawl = new cawl_QueryBuilder();
cawl.Select("Users_Title");
cawl.Select("Users_Age");
cawl.Select("Users_Sex");
cawl.Select("CarBrand");
cawl.Join("UsersList";"OwnerColumn");
cawl.Get('UserCarsList');

StringBuilder Result = new StringBuilder();
foreach (SPListItem item in cawl.ListItemCollection())
{
  Result.Append(item["Users_Title"].ToString() +
                 item["Users_Age"].ToString() +
                 item["Users_Sex"].ToString() +
                 item["CarBrand"].ToString());

}
Label1.Text = Result .ToString();

Upvotes: 2

naijacoder
naijacoder

Reputation: 464

1) Are you on SP 2007 or SP 2010 2)On easy approach is create a querystring in SP designer and then show the employee details based on the query string from the URL If doesn't solve your proble then yiu have to take Kyle advice and do it from code and LINQ could be a good way to go

Upvotes: -1

Related Questions