This is my query:
from forum in Forums
join post in Posts on forum equals post.Forum into postGroup
from p in postGroup
where p.ParentP
Forums
.GroupJoin(PostGroup, f => f.ID, p => p.ForumID, (f, p) => new { Forum = f, PostList = p })
.Where(anon => anon.PostList.Any(pl => pl.ParentPostID.Equals(0)))
.OrderBy(anon => anon.Forum.ForumID)
.Select(anon => new
{
Title = anon.Forum.Title,
ForumID = anon.Forum.ForumID,
LastPostTitle = anon.PostList.FirstOrDefault().Title,
LastPostAddedDate = anon.PostList.FirstOrDefault().AddedDate,
});
Something similar to this. I wasn't too sure because I didn't really have a view of the data model, but GroupJoin should be very similar to LEFT OUTER JOIN even though it doesn't realistically produce that in SQL.