I need some help on a sql query, for which I am using EntityFramework as ORM.
I have a User-- Group Many to Many relationship, i.e one user can belong to more than one group and one group can have more than 1 user.
The way I have done the mapping is..
USER tbl, Usr_Grp table, and Group Table where PK = Primary Key, FK = Foreign Key
USER table has --> UserId(PK) , UserName
Group table has --> GroupId (PK), GroupName
Usr_Grp table has --> Id(PK), UUserId(FK to usertable), GGroupId (FK to GroupTable)
The issue that I am facing is... In my api , I will get a set of GroupId's and I want to find only those Users that belong to all these GroupId's ( i.e all the groups that are passes in).
Is there a way to write this query in entity framework or Sql. I would really appreciate any help I can get on this.
-RN