title: Oracle SQL Query:Find out which year total sales amount is maximum
body: <p><em><strong>my working table, Table name: sales</strong></em></p>
  <p><strong>Here Is MY TABLE, [sl_no is primary key] table structure:</strong></p>
  <pre><code>CREATE TABLE  SALES 
    ( SL_NO NUMBER PRIMARY KEY, REGION VARCHAR2(10) NOT NULL, 
      MONTH VARCHAR2(20) NOT NULL, YEAR NUMBER NOT NULL, 
      SALES_AMOUNT NUMBER NOT NULL )
  </code></pre>
  <p><strong>and here is table data:</strong></p>
  <pre><code>SQL&gt; select * from sales;
  
       SL_NO REGION     MONTH                      YEAR SALES_AMOUNT
  ---------- ---------- -------------------- ---------- ------------
           1 east       december                   2011       750000
           2 east       august                     2011       800000
           3 west       january                    2012       640000
           5 east       march                      2012      1200000
           6 west       february                   2011       580000
           4 west       april                      2011       555000
  
  6 rows selected.
  </code></pre>
  <p>I have tried this query to view total sales amount of those[2011,2012] year;</p>
  <pre><code> SELECT year, SUM(sales_amount) FROM sales GROUP BY year;
  
        YEAR SUM(SALES_AMOUNT)
  ---------- -----------------
        2011           2685000
        2012           1840000
  </code></pre>
  <p><strong>MY GOAL:&gt; I want to find out the year of maximum sales amount.</strong>
  I tried this,and work perfectly...but when <em><strong>i want to display that year also</strong></em>, it gives an Error.</p>
  <pre><code>SQL&gt; select  max(sum(sales_amount)) from sales group by year;
  
  MAX(SUM(SALES_AMOUNT))
  ----------------------
                 2685000
  
  SQL&gt; select year, max(sum(sales_amount)) from sales group by year;
  select year, max(sum(sales_amount)) from sales group by year
         *
  ERROR at line 1:
  ORA-00937: not a single-group group function
  </code></pre>
  <p><strong>Extra addition: if multiple rows have same value means....when sales amount of both year[2011,2012] remain same, Then....</strong></p>
  <p>plZ help me to Solve this problem.</p>