I'm having problems quering this (I am new to LINQ, please forgive me) and I have spent hours trawling the web. In SQL I just want to do this
SELECT c.Forname, c.Surname cg.Title, g.GroupName
FROM Contact c
inner join ContactGroup cg on cg.ContactID = c.ID
inner join Group g on cg.GroupNameID = g.ID
WHERE g.ID=1;
I have attempted it but failed miserably as :
var result =
from c in cc.Contacts
from cg in c.ContactGroups
from g in cg.Group
where g.ID==1
select new
{
c.Forename,
c.Surname,
cg.Title,
g.GroupName
};
Can someone please show me what I am doing wrong or direct me to somewhere with further information?
Much thanks.