SELECT e.dept_no,d.emp_no,salary from salaries d 
inner join (#拉一张非管理员的员工清单
    SELECT a.emp_no,b.dept_no from employees a 
            LEFT join dept_emp b on a.emp_no=b.emp_no and b.to_date='9999-01-01'
    #连表条件为部门编号、员工编号都对应
           LEFT JOIN dept_manager c on c.dept_no=b.dept_no and c.emp_no=b.emp_no and b.to_date='9999-01-01'
           #where 条件筛除管理者
    where c.emp_no is null) as e
      on d.emp_no=e.emp_no and d.to_date='9999-01-01'
      where e.dept_no like 'd%'