How to use group by and having count in Linq
- by Luke
I am having trouble trying to convert the following query from SQL to Linq, in particular with the having count and group by parts of the query:
select ProjectID
from ProjectAssociation
where TeamID in ( select TeamID
from [User]
where UserID in (4))
group by ProjectID
having COUNT(TeamID) = (select distinct COUNT(TeamID)
from [User]
where UserID in (4))
Any advice on how to do so would be much appreciated.