title: Return the row with max value for each group
body: <p>I have the following table with name <strong>t2</strong>:</p>
  <pre><code>  realm   |    race    | gender | total  
  ----------+------------+--------+--------
   Buffalo  | faerie     | F      |   5972
   Buffalo  | faerie     | M      |   2428
   Buffalo  | footballer | F      |   1954
   Buffalo  | footballer | M      |   2093
   Buffalo  | raccoon    | F      |   2118
   Buffalo  | raccoon    | M      |   1237
   Buffalo  | shark      | F      |  12497
   Buffalo  | shark      | M      |   3621
   Buffalo  | wizard     | F      |    468
   Buffalo  | wizard     | M      |  11079
   Camelot  | faerie     | F      |   2414
   Camelot  | faerie     | M      |   1455
  </code></pre>
  <p>I want to create a query that just selects the realm, race and gender with the highest total. Every time I use <code>GROUP BY</code> I keep getting both genders.</p>
  <p>The output table looks like this:</p>
  <pre><code>  realm   |    race    | gender | total  
  ----------+------------+--------+--------
   Buffalo  | faerie     | F      |   5972
   Buffalo  | footballer | M      |   2093
   Buffalo  | raccoon    | F      |   2118
  ...
  </code></pre>
  <p>I think I have a very poor understanding on how to compare rows.<br />
  I can't figure out how to write the <code>WHERE</code> clause so that when I <code>GROUP BY realm,race,gender</code>, I only get 1 gender.</p>