The problem is that your subselect is not correlated. In other words, you need to join sp in the main query to supplier in the subquery -- don't join the tables in the subquery. Specifically, the query should be:
I wrote the same thing in my reply below, but didn't point it out specifically.SELECT * FROM sp WHERE NOT EXISTS ( SELECT 1 FROM supplier -- note SP doesn't appear here! WHERE supplier.num = sp.num -- sp is from main query )
In reply to Re^4: nested dbi queries question
by VSarkiss
in thread nested dbi queries question
by philosophia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |