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
|
3424 Discussions
|
Please Login in order to post a comment
SELECT MAX(months*salary),COUNT(NAME) FROM EMPLOYEE WHERE months*salary in(SELECT MAX(months*salary) FROM EMPLOYEE);
MYSQL: SELECT earnings, COUNT(name) FROM (SELECT *, salary*months AS earnings FROM employee) AS er WHERE earnings IN (SELECT MAX(salary*months) FROM employee) GROUP BY earnings
SELECT (salary * months) AS earnings, COUNT(*) FROM Employee GROUP BY earnings ORDER BY earnings DESC LIMIT 1;
select a.earningMax, count(*) from employee, (select max((months * salary)) as earningMax from employee) as A where months * salary = A.earningMax group by a.earningMax
MySQL:
SELECT MAX(months*salary) as earnings,' ',(SELECT COUNT(*) FROM EMPLOYEE WHERE months*salary=(SELECT MAX(months*salary) FROM EMPLOYEE)) FROM EMPLOYEE;