title: Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
body: <p>My query below runs fine without the MAX(colName) lines. The original query selects about 100 columns, but now the MAX(colName) columns need to be added. Obviously when I add them, MS SQL complains with the error:</p>
  
  <p><code>"Column 'applicationId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause"</code></p>
  
  <p>Is there any way to add these computed value columns without having to change the other 100 columns in the select?? The example below is simplified but the original query is a lot bigger and more complex. </p>
  
  <pre><code>                SELECT 
                       g.applicationId,
                       -- (another 100 or so columns just like above)
                      -- max(g.AScore) as AScore,
                      -- max(g.APercentile) as APercentile
                  FROM application a
                  LEFT JOIN GREScores g ON a.applicationId = g.applicationId
                  WHERE g.applicationID = 1
  </code></pre>
  
  <p>Thanks</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Looks like the subquery approach mentioned by @OVais did the trick. If you believe this is not a good approach, please tell me why: </p>
  
  <pre><code>                SELECT 
                       g.applicationId,
                       -- (another 100 or so columns just like above)
                      (SELECT MAX(AScore) FROM GREScores WHERE GREScores.applicationId = a.applicationId) AS tAScore
                      -- max(g.APercentile) as APercentile
                  FROM application a
                  LEFT JOIN GREScores g ON a.applicationId = g.applicationId
                  WHERE g.applicationID = 1
  </code></pre>