title: oracle select data between date range using connect by clause
body: <p>I have data something like this</p>
  
  <pre><code>date        count
  01-JAN-2015 10
  02-JAN-2015 20
  03-JAN-2015 30
  01-FEB-2015 4
  02-FEB-2015 8
  03-FEB-2015 12
  01-MAR-2015 5
  02-MAR-2015 10
  03-MAR-2015 15
  01-APR-2015 6    
  02-APR-2015 12
  03-APR-2015 18
  01-MAY-2015 7    
  02-MAY-2015 14
  03-MAY-2015 21
  01-JUN-2015 8   
  02-JUN-2015 16
  03-JUN-2015 24
  01-JUL-2015 8   
  02-JUL-2015 16
  03-JUL-2015 24
  </code></pre>
  
  <p>I need  result group by months with variable number of months from current month</p>
  
  <p>Example If I need only for next 2 months from today result is</p>
  
  <pre><code>MAR-2015  24
  APR-2015  36
  </code></pre>
  
  <p>and If I need only for next 3 months from today result is</p>
  
  <pre><code>MAR-2015  24
  APR-2015  36
  MAY-2015  42
  </code></pre>
  
  <p>I have query to the get variable months with  start date and end date of month </p>
  
  <pre><code>SELECT TO_CHAR(TRUNC(ADD_MONTHS(sysdate,level),'MM'),'MON-yyyy') MNTH ,
    TO_CHAR(TRUNC(ADD_MONTHS(sysdate,level),'MM'),'dd-MON-yyyy') strt_date,
    TO_CHAR(TRUNC(LAST_DAY(ADD_MONTHS(SYSDATE, level))),'dd-MON-yyyy') end_date
  FROM dual
    CONNECT BY LEVEL &lt;= p_level
  </code></pre>
  
  <p>Where <code>p_level</code> is variable number of months  like 2,3,4....</p>
  
  <p>Can any 1 help using SQL query without using PL/SQL </p>