I have 2 lists, one list contains a lookup to another.
I have used SPMetal to generate entity.cs based on this article: http://www.eggheadcafe.com/tutorials/aspnet/b0c1cd0d-fe82-444e-a16e-7d3fb7d38eca/join-lists-with-linq--sh.aspx
I don't think I need to go the object LINQ route, as in the article because I have a lookup field on which I want to base the join.
I've gotten this far:
EntityDataContext site = new EntityDataContext(this.SiteURL); site.ObjectTrackingEnabled = false; EntityList<ListA> listAItems = site.GetList<ListA>(ListAName); EntityList<ListB> listBItems = site.GetList<ListB>(ListBName);
This works so far and gives 2 flat EntityLists for both Sharepoint Lists.
From this point on, how would I create a query to just join, based on the lookup field?
If I was doing it in SQL, this is the statement I would be writing:
Select [fields] from table1 AA inner join table2 BB on AA.lookupfield = AA.Title/ID where BB.field = $inputFromUser