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);
'알고리즘 > leetcode' 카테고리의 다른 글
183. Customers Who Never Order (0) | 2023.04.30 |
---|---|
178. Rank Scores (0) | 2023.04.29 |
258. Add Digits (0) | 2023.04.26 |
1372. Longest ZigZag Path in a Binary Tree - python (0) | 2023.04.22 |
946. Validate Stack Sequences - python (0) | 2023.04.15 |
댓글