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.
SELECT top 1 (salary*months), count(*)
FROM employee
GROUP BY (salary*months)
ORDER BY (salary*months) desc;
--groups the salaries by salary * month
--then orders them from highest salary to lowest salary
-- it counts how many is in each salary bracket
-- as it puts them from highest to lowest, I can just do top 1
-- this returns count of people with highest potential salary
Top Earners
You are viewing a single comment's thread. Return to all comments →
That is like my MS SQL solution:
SELECT top 1 (salary*months), count(*) FROM employee GROUP BY (salary*months) ORDER BY (salary*months) desc;
--groups the salaries by salary * month --then orders them from highest salary to lowest salary -- it counts how many is in each salary bracket -- as it puts them from highest to lowest, I can just do top 1 -- this returns count of people with highest potential salary