我正在使用oracle 11g命令行,并对11g附带的默认EMPLOYEES表使用基本查询:-
SELECT EMPLOYEES.EMPLOYEE_ID, EMPLOYEES.FIRST_NAME, EMPLOYEES.LAST_NAME,
EMPLOYEES.MANAGER_ID
FROM
EMPLOYEES
WHERE
EMPLOYEES.MANAGER_ID IN
(SELECT EMPLOYEES.EMPLOYEE_ID
FROM EMPLOYEES
WHERE EMPLOYEES.MANAGER_ID =
(SELECT EMPLOYEES.MANAGER_ID
FROM EMPLOYEES
WHERE
EMPLOYEES.FIRST_NAME ='Nancy'));
========================================
EMPLOYEE_ID FIRST_NAME LAST_NAME MANAGER_ID
----------- -------------------- ------------------------- ----------
109 Daniel Faviet 108
110 John Chen 108
111 Ismael Sciarra 108
112 Jose Manuel Urman 108
113 Luis Popp 108
206 William Gietz 205
已选择6行。
我无法理解为什么id = 206的最后一行在那里,而108是Nancy的EMPLOYEE_ID,与206 id无关。