How to implement NOT IN subquery in LinqToOracle?
Posted: Wed 21 Jul 2010 09:46
I'm having problems with converting query that has "not in" subquery to Linq object. The query is
In LinqToSQL it should look like:
However it returns all records from MyTable.
I've tried to split it in 2 different queries:
the first query returns correct result but the second is still ignoring the "where !contains" condition.
The same thing happen with both .Contains() and .Any()
Is there any way to get "not in" subquery in LinqToOracle?
Code: Select all
SELECT * FROM MyTable
WHERE MyID NOT IN (SELECT ID FROM MyOtherTable)
Code: Select all
var q = from t1 in MyTable
let t2s = from t2 in MyOtherTable
select t2.ID
where !t2s.Contains(t1.MyID)
select t1;
I've tried to split it in 2 different queries:
Code: Select all
var mySet = from t2 in MyOtherTable select t2.ID;
var q = from t1 in MyTable
where !mySet.Contains(t1.MyID)
select t1;
The same thing happen with both .Contains() and .Any()
Is there any way to get "not in" subquery in LinqToOracle?