题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取每个部门中当前员工薪水最高的相关信息
https://www.nowcoder.com/practice/4a052e3e1df5435880d4353eb18a91c6
select a.dept_no , a.emp_no , a.salary as maxSalary from ( select dept_no , emp_no , salary, rank() over (partition by dept_no order by salary desc ) as rk from dept_emp left join salaries using (emp_no) where date_format(now(),'%Y-%m-%d') >= dept_emp.from_date and date_format(now(),'%Y-%m-%d') <= dept_emp.to_date ) a where a.rk=1
