title: Using Max() on SUM() Aggregate function in Oracle
body: <p>I am trying to write a query in Oracle which will return both the pub_id and the maximum total revenue from a titles table which lists pub_id, sales, price. 
  I can get either a listing with pub_id and total revenues for each pub_id with</p>
  
  <pre><code> SELECT PUB_ID, SUM(SALES*PRICE) as TotalRevenue FROM TITLES GROUP BY PUB_ID;
  </code></pre>
  
  <p>Or I can get just the MAX(Sales*Price) with</p>
  
  <pre><code> SELECT MAX(SUM(sales*price)) FROM titles GROUP BY pub_id;
  </code></pre>
  
  <p>Any ideas how can I get the pub_id out with the maximum of the total revenue? </p>