title: MySQL select MAX(datetime) not returning max value
body: <p>Example table:</p>
  
  <pre><code>id   computer  app      version     build    date
  ---|---------|------|------------|-------|---------
  1  |  aaaa1  | app1 |   1.0.0    |   1   | 2013-11-11 09:51:07
  2  |  aaaa1  | app2 |   2.0.0    |   2   | 2013-11-12 09:51:07
  5  |  xxxx2  | app1 |   1.0.0    |   1   | 2013-11-13 09:51:07
  3  |  cccc3  | app2 |   3.1.0    |   1   | 2013-11-14 09:51:07
  4  |  xxxx2  | app1 |   1.0.0    |   2   | 2013-11-15 09:51:07
  5  |  cccc3  | app2 |   3.1.1    |   3   | 2013-11-16 09:51:07
  6  |  xxxx2  | app1 |   1.0.2    |   1   | 2013-11-17 09:51:07
  7  |  aaaa1  | app1 |   1.0.2    |   3   | 2013-11-18 09:51:07
  </code></pre>
  
  <p>Desired output (not exact format or listing order), getting latest install for each app on each computer:</p>
  
  <pre><code>7. aaaa1 - app1 - 1.0.2 - 3 - 2013-11-18 09:51:07
  2. aaaa1 - app2 - 2.0.0 - 2 - 2013-11-12 09:51:07
  6. xxxx2 - app1 - 1.0.2 - 1 - 2013-11-17 09:51:07
  5. cccc3 - app2 - 3.1.1 - 3 - 2013-11-16 09:51:07
  </code></pre>
  
  <p>My SQL statement:</p>
  
  <pre><code>SELECT 
          id,
          computer, 
          app, 
          version, 
          build, 
          MAX(date) AS installed
      FROM 
          data 
      WHERE 
          placement = 'xxx'
      GROUP BY 
          app, computer
      ;
  </code></pre>
  
  <p>This gives me:</p>
  
  <pre><code>1. aaaa1 - app1 - 1.0.0 - 1 - 2013-11-11 09:51:07
  </code></pre>
  
  <p>and not </p>
  
  <pre><code>7. aaaa1 - app1 - 1.0.2 - 3 - 2013-11-18 09:51:07
  </code></pre>
  
  <p>as I expected.</p>
  
  <p>MAX(date) works if I <strong>ONLY</strong> select MAX(date) and nothing else. But then I don't get any data to work with (just latest date).</p>
  
  <pre><code>SELECT 
          MAX(date) AS installed
  </code></pre>
  
  <p>I'm not an SQL ninja so I will soon go bald by scratching my head because of this. </p>