I've this query below working fine. However I want to implement it using Linq.
select u.ID, u.NAME
from Task t
join BuildingUser bu ON bu.ID_BUILDING = t.ID_BUILDING
join [User] u ON u.ID = bu.ID_USER
where t.ID IN (2,9) AND u.ID != t.ID_USER
group by u.id, u.name
having count(bu.ID_BUILDING) = (SELECT COUNT(t2.ID_BUILDING) FROM Task t2 WHERE t2.ID IN (2,9))
I don't know how to Group and use Having clause at the same time.
You can try something like this:
Or if you have navigation properties set up correctly, you can try this: