title: SQL: max(count((x))
body: <p>I have a table of baseball fielding statistics for a project. There are many fields on this table, but the ones I care about for this are <code>playerID</code>, <code>pos</code> (position), <code>G</code> (games). </p>
  
  <p>This table is historical so it contains multiple rows per <code>playerID</code> (one for each year/pos). What I want to be able to do is return the position that a player played the most for his career. </p>
  
  <p>First what I imaging I have to do is count the games per position per <code>playerID</code>, then return the max of it. How can this be done in SQL? I am using SQL Server. On a side note, there may be a situation where there are ties, what would max do then?</p>