Top Earners

Sort by

recency

|

3283 Discussions

|

  • + 0 comments

    SELECT MAX(salary*months), COUNT(*) from Employee
    WHERE (salary*months) = (SELECT MAX(salary*months) from Employee);

  • + 0 comments

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

  • + 0 comments

    SELECT MAX(E.SALARY * E.MONTHS) AS MAX_TOTAL_EARNINGS, COUNT(*) AS NUM_EMPLOYEES_WITH_MAX_TOTAL_EARNINGS FROM EMPLOYEE E WHERE E.SALARY * E.MONTHS = (SELECT(MAX(E.SALARY * E.MONTHS)) FROM EMPLOYEE E);

  • + 0 comments
    with totale as(
        select employee_id, (salary*months) as total_earning
        from employee
    )
    select max(total_earning), count(employee_id)
    from totale
    where total_earning =(
        SELECT MAX(total_earning)
        FROM totale
    );
    
  • + 0 comments

    select employee_id, months * salary as total into #total_earnings from Employee

    select total, count(distinct employee_id) from #total_earnings where total = (select max(total) from #total_earnings) group by total