We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
yeah this solution is simple but not so semantic or obvious.
Before looking at the discussions board I came up with this solution:
select max(earnings),count(employee_id)
from(
select earnings, employee_id,rank()over(order by earnings desc)rnk
from(
select max(months * salary) earnings, employee_id
from employee
group by employee_id
))
where rnk=1;
Top Earners
You are viewing a single comment's thread. Return to all comments →
yeah this solution is simple but not so semantic or obvious. Before looking at the discussions board I came up with this solution:
select max(earnings),count(employee_id) from( select earnings, employee_id,rank()over(order by earnings desc)rnk from( select max(months * salary) earnings, employee_id from employee group by employee_id )) where rnk=1;