title: How to find maximum value after a group by and joins?
body: <p>How would you get the maximum revenue for username using two joins and group by? I'm expecting to get one row that is username and the maximum revenue. The reason why it needs to be sum first is because a user may have multiple different videos giving him/her revenue. Thus, the revenue must be aggregated.</p>
  <p>I've tried this:</p>
  <pre><code>SELECT first_username||' '||last_username as username, max(sum(revenue)) max_revenue
  FROM uploader
  JOIN video on video.uploader_id= uploader.uploader_id
  JOIN users on uploader.user_id = users.user_id
  GROUP BY first_username||' '||last_username;
  </code></pre>
  <p>This results in a &quot;not a single-group group function&quot; error. Is there an alternative way of doing this?</p>