What is the equivalent of following statement in LINQ:
Select t1.appname, t1.julianDte, t1.cat
From table1 t1
Where NOT EXISTS
( Select *
from table t2
where t1.cat = t2.cat AND t2.julianDte < t1.julianDte )
What is the equivalent of following statement in LINQ:
Select t1.appname, t1.julianDte, t1.cat
From table1 t1
Where NOT EXISTS
( Select *
from table t2
where t1.cat = t2.cat AND t2.julianDte < t1.julianDte )
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 @David 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
};