Try this Not Any
pattern.
var query = db.table1
.Where(t1 => !db.table2
.Any(t2 => t2.cat == t1.cat && t2.julianDte < t1.julianDte)
);
Query syntax version of @Amy B's answer (with !Any inverted to All):
from t1 in db.Table1
where db.Table2.All(t2 => t1.cat != t2.cat || t2.julianDte >= t1.julianDte)
select new
{
t1.appname,
t1.julianDte,
t1.cat
};
from t1 in Context.table1DbSet
let ok =
(from t2 in Context.table2DbSet
where t2.Idt1 = t1.Idt1 && t1.DateValid.HasValue
).Any()
where
t1.Active
&& !ok
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With