Dave Bell

Dave Bell

  • 1.5k
  • 108
  • 7.3k

How to write below query using EF?

May 1 2023 12:58 PM

I have injected IdentityUser to User table. EF created N:N UserStudent table. 

SELECT TOP 
      [Email]

  FROM [model].[dbo].[AspNetUsers] A, [model].[dbo].[AspNetUserRoles] B 
  where
  A.Id = B.UserId and B.RoleId = 'parent'
  and
 A.Id = (select UserId from [model].[dbo].[UserStudent] where StudentId = 'X')

 


Answers (5)