title: Grouping by date stored as varchar2
body: <p>I am trying to run the following query:</p>
  
  <pre><code>SELECT TAB.week_end, 
      COUNT(TAB.id)
  FROM (
          SELECT C.week_end,              
              C.ID   
          FROM my_table C     
          WHERE C.week_end IS NOT NULL
      ) TAB
  GROUP BY TAB.week_end, TAB.id
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>week_end  id
  2016-01   45000
  2016-02   61000
  2016-03   59000
  </code></pre>
  
  <p>What I'm getting is: </p>
  
  <pre><code>week_end  id
  2016-01   1
  2016-01   1
  2016-02   1
  2016-02   1
  </code></pre>
  
  <p>Now I know the difficulties when grouping by date. But in my case the date is already stored as <code>varchar2</code>. Anybody can help me out here? </p>