Dave Bell

Dave Bell

  • NA
  • 108
  • 8.7k

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)