title: Using MAX() without grouping by
body: <p>Im using Oracle-Apex
  I have a table with names and salaries. I want to get the name with the highest salary using MAX(salary).</p>
  
  <p>So the query is like this:</p>
  
  <pre><code>SELECT NAME FROM EMPLOYEE
  GROUP BY NAME
  HAVING MAX(SALARY) = SALARY;
  </code></pre>
  
  <p>This doesnt work, error ORA-00979: not a GROUP BY expression, appears. So i use this to stop that error:</p>
  
  <pre><code>SELECT NAME FROM EMPLOYEE
  GROUP BY NAME, SALARY
  HAVING MAX(SALARY) = SALARY;
  </code></pre>
  
  <p>And it groups every different salary in one row and returns the max salary in each row, since every salary is different, it returns every row.</p>
  
  <p>How do i group everything in one single big group without modyfing the tables? I mean i want this to work:</p>
  
  <pre><code>SELECT NAME FROM EMPLOYEE
  WHERE MAX(SALARY) = SALARY;
  </code></pre>
  
  <p>But with having. Its simple really, but i cant find the way.</p>