I\'m trying to find a way to convert this very complex SQL Query into LINQ and I can\'t seem to tackle all the embedded \"WHERE IN\" clauses. Would someone be so kind as to len
You convert the SQL IN
statement to linq with either Contains or Any
Contains
from dv in db.Device
where
(from au in db.Audit
where au.AuditDate >= DateTime.Now.AddMonths(-3)
select au.AccountID).Contains(dv.AccountID)
Any
from dv in db.Device
where
db.Audit.Any(au => au.AuditDate >= DateTime.Now.AddMonths(-3) &&
au.AccountID == dv.AccountID)