use a left outer join to your "not in" table, group by some columns in table a and at least one column in table b (the "not in" table) having b.some_column is null.
This is much more effecient than a not in statement.
i.e.
Code:
select a.col1, a.col2
from tablea as a
left outer join tableb as b
on b.fkey_id = a.id
group by a.col1, a.col2, b.some_column
Leave a comment: