|
Here's a question:
Create a query to display the name, hire date, and salary for all employees who have both the same salary and commission as Scott.
Note: Do not display SCOTT in the result set.
ENAME HIREDATE SAL
FORD 03-DEC-81 3000
The following is how I tried:
SQL> select sal, comm from emp where ename = 'SCOTT';
SAL COMM
---------- ----------
3000
SQL> select ename, hiredate, sal from emp where (sal, comm) in (select sal, comm from emp where ename = 'SCOTT') and ename != 'SCOTT';
no rows selected
I got no result, which is dues to, I suppose, the null value contained in the "comm" column, so the "where (sal, comm) in" statement can't function.
Could someone give me a hint, thanks in advance. |
|