题解 | #获取所有非manager员工当前的薪水情况#
获取所有非manager员工当前的薪水情况
https://www.nowcoder.com/practice/8fe212a6c71b42de9c15c56ce354bebe
SELECT t.`dept_no`, t.`emp_no`, s.`salary` FROM (SELECT e.`emp_no`, de.`dept_no` FROM `employees` e JOIN `dept_emp` de ON e.`emp_no` = de.`emp_no` WHERE de.`to_date` = "9999-01-01" AND e.`emp_no` NOT IN ( SELECT emp_no FROM `dept_manager` WHERE `to_date` = "9999-01-01") ) t JOIN `salaries` s ON t.`emp_no` = s.`emp_no`