title: How to use SQL MAX(SUM()) function
body: <p>I need some help using the SQL <code>max</code> and <code>sum</code> aggregate functions in SQL.</p>
  
  <p>I want to display the first and last names of employees who have put in the most number of total hours on projects. And I want to list the employees with the highest total combined project hours.</p>
  
  <p>I have two tables:</p>
  
  <pre><code>employee: 
  FNAMEM--LNAME--SSN--BDATE--ADDRESS--SALARY--SUPERSSN--DNO
  
  works_on:
  ESSN--PROJECT_NUM--HOURS
  </code></pre>
  
  <p>This is what I have so far but there is a syntax error in the code:</p>
  
  <pre><code>select fname, lname, max(sum(hours)) "Total Hours", essn
  from employee, works_on
  where essn = ssn
  order by lname;
  </code></pre>
  
  <p>I know that <code>max(sum(hours))</code> does not work, what will give me the right result?</p>