title: How to select MAX from AVG?
body: <p>I'm practicing for my SQL exam and I can't figure out the following question:</p>
  
  <p>"Of the average amount paid per customer, show the highest amount."</p>
  
  <p>So to retrieve the average amount paid, I would do the following:</p>
  
  <pre><code>SELECT AVG(Amount) AS 'Average amount paid'
  FROM Payment;
  </code></pre>
  
  <p>Then I would like to retrieve the highest average amount out of this list of averages. I thought the following would do the trick:</p>
  
  <pre><code>SELECT MAX(AVG(Amount)) AS 'Highest average amount paid'
  FROM Payment;
  </code></pre>
  
  <p>This doesn't seem to work. I get the following error:</p>
  
  <blockquote>
    <p>Cannot perform an aggregate function on an expression containing an aggregate or a subquery.</p>
  </blockquote>
  
  <p>I would like some help with this. What is the correct way to approach this? Thank you in advance.</p>