Top Earners

Sort by

recency

|

3452 Discussions

|

  • + 0 comments

    my sql

    SELECT SALARY * MONTHS AS TOTAL, count(*) FROM EMPLOYEE group by total desc limit 1

  • + 0 comments

    select max(salary*months), count(salary) from employee group by salary*months order by salary*months desc limit 1

  • + 0 comments

    SELECT MAX(months * salary) AS max_earnings, COUNT(*) FROM employee WHERE salary * months = (SELECT MAX(months * salary) FROM employee);

  • + 1 comment

    MS SQL Server:

    with abc as (select name,(months*salary) as earnings from employee),

    def as (select earnings,count(name) as names from abc group by earnings)

    select top 1 * from def order by earnings desc

  • + 0 comments

    For MySQL

    SELECT MAX(MONTHS*SALARY), COUNT(*) FROM EMPLOYEE GROUP BY(MONTHS*SALARY) ORDER BY MONTHS*SALARY DESC LIMIT 1;