LINQ, Left Join, Only Get where null in join table
Posted
by kmehta
on Stack Overflow
See other posts from Stack Overflow
or by kmehta
Published on 2010-05-20T18:06:53Z
Indexed on
2010/05/20
18:10 UTC
Read the original article
Hit count: 284
Hi. I am trying to do a left outer join on two tables, but I only want to return the results from the first table where the second table does not have a record (null).
var agencies = from a in agencyList
join aa in joinTable
on a.AgencyId equals aa.AgencyId into joined
from aa in joined.DefaultIfEmpty()
where aa == null)
select a;
But this does not exclude the non null values of aa, and returns all the records just the same as if the 'where aa == null' was not there.
Any help is appreciated. Thanks.
© Stack Overflow or respective owner