Entity Framework query to select

table users: SSN, student name: SSN, school

I want to get all the SSNs for people who are not students. How to write this with entity infrastructure?

+4
source share
1 answer
var ssnList = Context.Peoples .Where( p => !Context.Students .Any(s => s.SSN == p.SSN)) .Select( p => p.SSN).ToList(); 
+7
source

Source: https://habr.com/ru/post/1341160/


All Articles