How to write sub queries like these in EF?
select * from table1 where col1 in (select col1 from table2 where col2 = 'xyz')
or
select * from table1 where col1 not in (select col1 from table2 where col2 = 'xyz')
I tried something like these
from t1 in table1
where (from t2 in table2 where col2 = 'xyz' select t2.col1).Contains(t1.col1)
select t1
and
from t1 in table1
where !(from t2 in table2 where col2 = 'xyz' select t2.col1).Contains(t1.col1)
select t1
these queries are working fine LinqPad or Linq to Sql