Linq, double left join and double count

Posted by Fabian Vilers on Stack Overflow See other posts from Stack Overflow or by Fabian Vilers
Published on 2010-03-23T21:18:16Z Indexed on 2010/03/24 0:23 UTC
Read the original article Hit count: 1393

Filed under:
|
|
|

Hi!

I'm looking to translate this SQL statement to a well working & performant LINQ command. I've managed to have the first count working using the grouping count and key members, but don't know how to get the second count.

select main.title, count(details.id) as details, count(messages.id) as messages
from main
 left outer join details on main.id = details.mainid
 left outer join messages on details.id = messages.detailid
group by main.title

Any advice is welcome!

Fabian

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about sql