先考虑用group by找到各个部门的部门号和相应最高工资 with (select e1.dept_no, max(s1.salary) from dept_emp e1 join salaries s1 on e1.emp_no = s1.emp_no group by e1.dept_no) as t1然后同样通过连接获取部门、员工和薪资的联系,等值选取即可 select e.dept_no, e.emp_no, s.salary as `maxSalary` from dept_emp e join salaries s on e.emp_no = s.emp_no where (e....