title: Multiple grouped items
body: <p>I can't seem to find out how to get the functionality I want.  Here is an example of what my table looks like:</p>
  
  <pre><code>EmpID     |  ProjectID     |    hours_worked   | 
    3             1                    8
    3             1                    8
    4             2                    8
    4             2                    8
    4             3                    8
    5             4                    8
  </code></pre>
  
  <p>I want to group by EmpID and ProjectID and then sum up the hours worked.  I then want to inner join the Employee and Project table rows that are associated with EmpID and ProjectID, however when I do this then I get an error about the aggregate function thing, which I understand from research but I don't think this would have that problem since there will be one row per EmpID and ProjectID.</p>
  
  <p><strong>Real SQL:</strong></p>
  
  <pre><code>SELECT
      WorkHours.EmpID,
      WorkHours.ProjectID,
      Employees.FirstName
  FROM WorkHours
  INNER JOIN Projects ON WorkHours.ProjectID = Projects.ProjectID
  INNER JOIN Employees ON WorkHours.EmpID = Employees.EmpID
  GROUP BY WorkHours.ProjectID, WorkHours.EmpID
  </code></pre>
  
  <p>This gives the error:</p>
  
  <blockquote>
    <p>Column 'Employees.FirstName' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.</p>
  </blockquote>