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
Try something like this:
from forum in Forums
join post in Posts on forum equals post.Forum into postGroup
// from p in postGroup
// where p.ParentPostID==0
select new
{
forum.Title,
forum.ForumID,
LastPostTitle = postGroup.FirstOrDefault(p => p.ParentPostID==0).Title,
LastPostAddedDate = (DateTime?)postGroup.FirstOrDefault(p => p.ParentPostID==0).AddedDate
}).OrderBy(o=>o.ForumID)
properties that return empty from the left join must also be nullable. So int => int? and DateTime => DateTime? etc..