title: How to use MAX in MySQL?
body: <p>Assume the following table/data:</p>
  
  <pre><code>person_id  age  gender  name
  1          25   Female  Jane
  2          28   Male    John
  3          29   Female  Jill
  4          24   Male    Jack
  </code></pre>
  
  <p>How do I query for the oldest Male and Female?</p>
  
  <p>This is not working: <code>SELECT person_id, max(age), gender, name FROM person GROUP BY gender</code></p>
  
  <p>as it returns:</p>
  
  <pre><code>person_id  age  gender  name
  2          28   Male    John
  1          29   Female  Jane
  </code></pre>
  
  <p>The desired result is:</p>
  
  <pre><code>person_id  age  gender  name
  2          28   Male    John
  3          29   Female  Jill
  </code></pre>
  
  <p>What's wrong with my SQL?</p>