How to: LINQ - Left Join, Group By, and Count #dev #development #answer
How to: LINQ – Left Join, Group By, and Count #dev #development #answer
LINQ – Left Join, Group By, and Count
Let’s say I have this SQL:
SELECT p.ParentId, COUNT(c.ChildId) FROM ParentTable p LEFT OUTER JOIN ChildTable c ON p.ParentId = c.ChildParentId GROUP BY p.ParentId
How can I translate this into LINQ to SQL? I got stuck at the COUNT(c.ChildId), the generated SQL always seems to output COUNT(*). Here’s what I got so far:
from p in context.ParentTable join c in…
View On WordPress

















