SELECT e.emp_no emp_no, s.salary salary, e.last_name last_name, e.first_name first_name FROM salaries as s, employees as e where s.emp_no = e.emp_no and s.salary = ( SELECT max(s2.salary) from salaries s2 WHERE s2.salary < ( select max(salary) from salaries WHERE to_date = '9999-01-01' ) AND s2.to_date = '9999-01-01' );
思路: 连接两个表, 选择salary 最大的, 然后排除, 然后再选择最大的。