在这里要注意下面三种都可以

select s.*, d.dept_no
from salaries s inner join dept_manager d on s.emp_no=d.emp_no
where s.to_date='9999-01-01'
and d.to_date='9999-01-01'
order by s.emp_no

或者

select s.*, d.dept_no
from salaries s inner join dept_manager d on s.emp_no=d.emp_no and s.to_date=d.to_date
where s.to_date='9999-01-01'
order by s.emp_no

或者

select s.*, d.dept_no
from salaries s inner join dept_manager d on s.emp_no=d.emp_no 
and s.to_date='9999-01-01'
and d.to_date='9999-01-01'
order by s.emp_no