ngreenleaf
Programmer
I have written a rather simple query. It is:
select field1 from table1
where field1 not in (select field2 from table2);
Note that field 2 is the foreign key to field1. The query is a little more complex than this, but I can reduce it to this and the same problem results.
This query returns nothing. When I run the same query replacing NOT IN with IN, I get the proper values returned. There is definitely more than one value that meets the NOT IN criteria. When I replace the subquery with a list of the values it returns (eg, NOT IN ('abc','def','ghi')) - then the query returns the proper values. When I run "select field2 from table2" I get the values I expect to see.
Does anyone have any suggestions about this condition. I have been using the NOT IN operator successfully in many other queries.
select field1 from table1
where field1 not in (select field2 from table2);
Note that field 2 is the foreign key to field1. The query is a little more complex than this, but I can reduce it to this and the same problem results.
This query returns nothing. When I run the same query replacing NOT IN with IN, I get the proper values returned. There is definitely more than one value that meets the NOT IN criteria. When I replace the subquery with a list of the values it returns (eg, NOT IN ('abc','def','ghi')) - then the query returns the proper values. When I run "select field2 from table2" I get the values I expect to see.
Does anyone have any suggestions about this condition. I have been using the NOT IN operator successfully in many other queries.