title: Fetch row with max occurrence in Oracle
body: <p>I have a table like:</p>
  
  <pre><code>SALES
  
  PROD_CODE   SALE_ID 
  321         30
  123         67
  321         46
  321         82
  123         48
  321         91
  </code></pre>
  
  <p>For the code:</p>
  
  <pre><code>SELECT PROD_CODE, COUNT(SALE_ID) AS TOTAL_SALES
  FROM SALES
  GROUP BY PROD_CODE
  ORDER BY COUNT(SALE_ID) DESC;
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>PROD_CODE  TOTAL_SALES
  321        4
  123        2
  </code></pre>
  
  <p>But, when I am expecting only the prod_code with the maximum number of sales as the output,</p>
  
  <p>like:</p>
  
  <pre><code>PROD_CODE
  321
  </code></pre>
  
  <p>For the code:</p>
  
  <pre><code>SELECT PROD_CODE
  FROM (SELECT MAX(COUNT(SALE_ID)) FROM SALES
  GROUP BY SALE_ID);
  </code></pre>
  
  <p>The code isn't working!</p>