var groups = from p in dc.Pool
join pm in dc.PoolMembers on p.ID equals pm.PoolID
group p by p.Group into grp
select new { grp.ID };
This isn't working. Basically I want to do the grouping, and then select certain columns, but when I do select new { grp. } I get no intellisense, so I'm obviously doing something wrong.
Any ideas?
I am not sure but, does the following code work?
var groups = from p in dc.Pool
join pm in dc.PoolMembers on p.ID equals pm.PoolID
group p by p.Group into grp
select grp.Select(g=> g.ID);
EDIT
var groups = from p in dc.Pool
join pm in dc.PoolMembers on p.ID equals pm.PoolID
group p by p.Group into grp
select grp.Select(g=> new{
Id = g.Id,
GroupName = grp.Key.Name,
Contribution = pm.Contribution,
GameName = p.GameName, });
I think this is what you are looking for
var groups = from p in dc.Pool
join pm in dc.PoolMembers on p.ID equals pm.PoolID
group p by p.Group into grp
select new { grp.Key.ID, GroupName = grp.Key.Group.Name, grp.Key.GameName };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With