select a.emp_no,a.salary,e.last_name,e.first_name from employees e inner join (select emp_no,max(salary) as salary from salaries where salary<>(select max(salary) from salaries where to_date='9999-01-01') )a on e.emp_no=a.emp_no
select a.emp_no,a.salary,e.last_name,e.first_name from employees e inner join (select emp_no,max(salary) as salary from salaries where salary<>(select max(salary) from salaries where to_date='9999-01-01') )a on e.emp_no=a.emp_no