Entity Framework choose query

c# entity-framework linq-to-entities

Question

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?

1
4
2/24/2011 4:28:28 PM

Accepted Answer

var ssnList = Context.Peoples
                     .Where( p => !Context.Students
                                          .Any(s => s.SSN == p.SSN))
                     .Select( p => p.SSN).ToList();
7
2/24/2011 4:22:55 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow