📜  linq left join group by - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:15.506000             🧑  作者: Mango

代码示例1
from p in context.ParentTable
join c in context.ChildTable on p.ParentId equals c.ChildParentId into j1
from j2 in j1.DefaultIfEmpty()
group j2 by p.ParentId into grouped
select new { ParentId = grouped.Key, Count = grouped.Count(t=>t.ChildId != null) }