select months * salary as earnings,
count(*)
from employee
where months * salary =
(select max(months * salary) as max_earnings
from employee)
group by earnings
where 절의 서브쿼리의 output이 하나일 때는 =을 사용해도 된다.
output이 여러 개의 경우 in을 사용
'섭섭의 공부 > SQL' 카테고리의 다른 글
[LeetCode] Department Highest Salary (0) | 2021.12.24 |
---|---|
[HackerRank] Challenges (0) | 2021.12.23 |
[HackerRank] Symmetric Pairs (0) | 2021.12.21 |
[LeetCode] Rising Temperature (0) | 2021.12.21 |
[LeetCode] Employees Earning More Than Their Managers (0) | 2021.12.02 |