I'm trying to do this query but it doesn't work for me.
Show all results for employees earning less than ALLEN
This is the employees table:
EmpNb, EName, - Job, Mgr, HireDate, Sal, Comm, DeptNb
7499, ALLEN, SALESMAN, 7698, 1981-02-20, 1600.00 , 300.00, 30
7654, MARTIN, SALESMAN, 7698, 1981-09-28, 1250.00, 1400.00, 30
7934, MILLER, CLERK, 7782, 1982-01-23, 1300.00, NULL, 10
7844, TURNER, SALESMAN, 7698, 1981-09-08, 1500.00, 0.00, 30
7782, CLARK, MANAGER, 7839, 1981-06-09, 2450.00, NULL, 10
7698, BLAKE, MANAGER, 7839, 1981-05-01, 2850.00, NULL, 30
I need help
CodePudding user response:
A subquery should do the job:
select * from employees
where Sal < (select Sal from employees where EName = 'ALLEN')