알고리즘/leetcode
184. Department Highest Salary
1.5볼트
2023. 4. 28. 04:44
728x90
이것들은 아직도 로그인 인증 버그를 쳐 안 잡고 있다
각각 부서에서 가장 높은 급여를 받는 사람 찾기
그룹별이니까 group by 사용하고 테이블 두개를 조인한다
select b.name Department ,a.name as Employee ,a.salary Salary
from Employee a join Department b on (a.departmentId=b.id)
where (a.departmentId,a.salary) in(select departmentId,max(salary)
from Employee
group by departmentId);