Top Earners

  • + 0 comments

    After seeing answers from others I am shocked no one used CONCAT as in the expected output the expected results is not two columns but a single column containing two values with space. Here is my answer, Any query improvement is appreciated.

    and a count of the number of employees who have earned (which is ) as two space-separated values.

    SET NOCOUNT ON;
    
    SELECT CONCAT((salary*months)," ",count(salary*months)) FROM employee
    WHERE (salary*months) = (SELECT MAX(salary*months) FROM employee)
    GROUP BY (salary*months)
    
    go