title: Limit Max and Group by returned too many rows
body: <p>I'm using a SQL Server database.</p>
  
  <p>Given the following query, I'm trying to get the highest score for each class. The <code>Scores</code> table has 50 rows for two classes so I want a total of 2 rows. But, because I have the <code>Scores.Id</code>, it returns each row for the <code>Scores</code> since <code>Scores.Id</code> is unique. Of course the simple solution is to remove the <code>Scores.Id</code> column except I need to know the <code>Scores.Id</code> to do additional lookup.</p>
  
  <pre><code>SELECT 
      Class_Id, Scores.Id, MAX(Scores.ClassScore) AS Score
  FROM  
      Classes 
  INNER JOIN
      Scores ON Classes.Id = Scores.Class_Id                
  GROUP BY 
      Scores.Class_Id, Scores.Id
  </code></pre>