Ryan
Ryan

Reputation: 5546

Entity Framework query to select

table people: SSN, name table students: SSN, school

I want to get all SSN for people who are not students. How do I write this with entity framework?

Upvotes: 4

Views: 13543

Answers (1)

BrokenGlass
BrokenGlass

Reputation: 160992

var ssnList = Context.Peoples
                     .Where( p => !Context.Students
                                          .Any(s => s.SSN == p.SSN))
                     .Select( p => p.SSN).ToList();

Upvotes: 7

Related Questions