title: ORA-00979: NOT A GROUP BY Expression Working with Dates in Oracle
body: <p>i have a Date datatype column named sDateTime, I want the data to be selected grouped by dates, in fact I want to show the sales sum of every day of a particular month. </p>
  
  <p>The sDateTime is of Date datatype but it also stores time with it so I need to convert it into only date format. I'm using the following query which throws an exception <strong>ORA-00979</strong> Anyone please help me with this.</p>
  
  <pre><code>SELECT sdatetime   AS Sale_Date,
         SUM(amount) AS Sale
  FROM   sales
  GROUP  BY To_char(sdatetime, 'yyyy-MM-dd')
  HAVING sdatetime BETWEEN To_date('2015-01-01', 'yyyy-MM-dd') AND
                           To_date('2015-01-09', 'yyyy-MM-dd') 
  </code></pre>