Хорошо! Надеюсь, это научит вас использовать таблицу псевдонимы . Без них это был столбец из таблицы emp
; поскольку она существует, не было выдано никакой ошибки.
У меня нет ваших таблиц, поэтому Скотт подойдет.
SQL> create table employees as select * From emp where deptno = 10;
Table created.
SQL> select a.*
2 from emp a
3 where
4 (select a.sal from dual d) in (select b.sal from employees b);
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- -------- ---------- ---------- ----------
7782 CLARK MANAGER 7839 09.06.81 2450 10
7839 KING PRESIDENT 17.11.81 5000 10
7934 MILLER CLERK 7782 23.01.82 1300 10
SQL> select a.*
2 from emp a
3 where
4 (select d.sal from dual d) in (select b.sal from employees b);
(select d.sal from dual d) in (select b.sal from employees b)
*
ERROR at line 4:
ORA-00904: "D"."SAL": invalid identifier
SQL>