title: Oracle PL/SQL group by issue
body: <p>I want to do this excercise for Oracle 10g Express</p>
  
  <blockquote>
    <p>"Write an SQL query to retrieve the department name, firstname,
    lastname, salary of the employee who earns the maximum salary for that
    department."</p>
  </blockquote>
  
  <p>I tried this code but it is not working for me. </p>
  
  <p>There are two tables named employees, departments</p>
  
  <p>ERROR is: ORA-00979: not a GROUP BY expression</p>
  
  
  
  <pre><code>SELECT first_name, last_name, departments.department_name, salary
  FROM employees, departments
  
  where employees.department_id = departments.department_id
  
  group by salary
  </code></pre>
  
  <p><em>Output must be like that.</em></p>
  
  <p><img src="https://i.stack.imgur.com/gqn6a.jpg" alt="enter image description here"></p>