C# LINQ: Join and Group

Posted by Soo on Stack Overflow See other posts from Stack Overflow or by Soo
Published on 2010-05-20T19:06:20Z Indexed on 2010/05/20 19:10 UTC
Read the original article Hit count: 364

Filed under:
|
|
|

I have two tables

TableA
aId
aValue

TableB
bId
aId
bValue

I want to join these two tables via aId, and from there, group them by bValue

var result = 
from a in db.TableA
join b in db.TableB on a.aId equals b.aId
group b by b.bValue into x
select new {x};

My code doesn't recognize the join after the group. In other words, the grouping works, but the join doesn't (or at least I can't figure out how to access all of the data after the join).

Any help would be appreciated. I'm a n00b.

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ