title: why does this give me the wrong customerNumber?
body: <p>I tried to get the customer that pay the maximum amount.  It gave me the maximum amount but the wrong customer. what should i do?</p>
  
  <pre><code>SELECT temp.customerNumber, MAX( temp.max ) AS sum
  FROM (
      SELECT p.customerNumber, p.amount AS max
      FROM payments p
      GROUP BY p.customerNumber
  ) AS temp
  </code></pre>