In SQL, I would say:
select a.* from TableA a left join TableB b on a.Type = b.Type and a.SomeDate < b.AnotherDate where b.ID is null
This will select all the records in table A, where in table B there is no record in the same Type and later date.
In Linq, how do you do this?
from a in TableA join b in TableB on a.Type equals b.Type into j
Thanks!
EDIT:
Several good answers were suggested, all of which relate to the specific needs expressed in this question, but they are all basically workarounds. In one way or another, they all move to embedded "existing" queries, while the SQL in the question is one neat query without any nesting. The case given here is only an example of a general principle; what I really would like to see is a Linq expression that will translate the (roughly) syntax of the aforementioned SQL query.
source share