Reputation: 464
When using SP 2007 and needed to do a join i just write the tables to a sql table and then use sql to join the tables. What i really need to do is quite simple. I have a master list and another list that users insert records too lets say a child list. When a user opens up the master list and clicks on an item i insert a record including their usernames to the child list All i want to show the users(based on login names) is the items they haven't read and what items. In sql i could have done something like e.g
Select * from master where not in(select from child where username ='blalal')
Any ideas.Not sure if to do it on the client or in the object model. Sure CAMl doesn't have joins
Thanks in advance
Upvotes: 1
Views: 2514
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: 0
Reputation: 91
Or you can use the Camelot .NET Connector from Bendsoft to JOIN any fields. It supports typical CRUD commands, including LEFT and INNER joins and UNION.
Upvotes: 0
Reputation: 6859
You can do joins in CAML queries as long as the two lists are related by a lookup field.
http://msdn.microsoft.com/en-us/library/ie/ee539975.aspx
Upvotes: 3