How might I convert this SQL code to LINQ?
SELECT * FROM tbl1
WHERE NOT EXISTS (SELECT NULL AS Expr1
FROM tbl2 AS tbl2_1
WHERE (T = 'literal') AND tbl1.Id = someId)
This is what I have, but it doesn't work:
from a in Tbl1
let b = from b in Tbl2 select b.someId
let c = from c in Tbl2 select c.T
where (!c.Contains("literal") & !(b.Contains(a.Id)))
select a
This should do the trick:
from t1 in Tbl1
where !(from t2 in Tbl2
where t2.T == "literal"
select t2.someId)
.Contains(t1.Id)
select t1
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