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.
- Prepare
- SQL
- Aggregation
- Top Earners
- Discussions
Top Earners
Top Earners
Sort by
recency
|
3232 Discussions
|
Please Login in order to post a comment
SELECT MAX(Salary*Months), COUNT(*) FROM employee GROUP BY Salary*Months ORDER BY max(Salary*Months)desc LIMIT 1;
worked for me: select salary * months as total , count(*) from employee group by total order by total desc limit 1;
SELECT Salary*Months, COUNT(*) FROM employee WHERE Salary*Months IN (SELECT MAX(Salary*Months) FROM employee) GROUP BY Salary*Months
select months*salary, count(*) from Employee group by months*salary order by months*salary desc limit 1;
This worked fine for me: SET @earnings = (SELECT MAX(salary * months) FROM employee); SELECT @earnings AS max_earnings, COUNT(*) FROM employee WHERE salary * months = @earnings;