SELECT DISTINCT 
  employees.departmentname, 
  employees.firstname, 
  employees.salary, 
  employees.departmentid
FROM employees
JOIN (
  SELECT MAX(salary) AS Highest, departmentID 
  FROM employees 
  GROUP BY departmentID
) departments ON employees.departmentid = departments.departmentid 
             AND employees.salary = departments.highest;
Why doesn't the DISTINCT work here? I'm trying to have each department to show only once because the question is asking the highest salary in each department.


 
     
     
     
    