Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> odd sub-select problem
I'm trying to do something which I think is very simple. I have a
table, A, which contains about 13000 rows, and a table B which
contains about 1600 rows.
Both these tables have a NAME column in the same domain. I want to display the NAMEs in A which are not in B. To do this, I'm using the following query:
SELECT NAME FROM A
WHERE NAME NOT IN (SELECT NAME FROM A)
This returns no rows. If, however, I do the following:
SELECT NAME FROM A
WHERE NAME IN (SELECT NAME FROM A)
(In other words, show me all the names in A that *are* in B)
I get about 1500 rows, as expected. Can anyone shed some light on this?
Thanks. Received on Mon Oct 29 2001 - 12:11:57 CST