Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Subquery with null returns
Hi, I have a subquery question, thanks for any response.
"EMP" table has two columns "empno" and "mgr", I do this
SELECT ENAME FROM EMP WHERE EMPNO NOT IN
(SELECT MGR FROM EMP);
I assumed this query will give me all employees who are not
manager but it returns me "no rows selected" bacause one employee
has null value in "MGR" column in subquery. Then I do,
SELECT ENAME FROM EMP WHERE EMPNO IN
(SELECT MGR FROM EMP);
it gives me the names of all managers as it should.
why with the same subquery one can retrives rows and one can't.
I did this query on 8.1.7
-DW-
Received on Thu Mar 27 2003 - 14:47:09 CST