原表:
select to_char(reg_Date,'yyyy-mm') regDate, count(*) count from Ep_Info t where 1=1 and t.reg_Date>=to_date('2013-02','yyyy-mm') and t.reg_Date<=to_date('2014-05','yyyy-mm') group by to_char(reg_Date,'yyyy-mm') order by to_char(reg_Date,'yyyy-mm')
按月累计求和:
select to_char(reg_Date,'yyyy-mm') regDate2,sum(count(*)) over(order by to_char(reg_Date,'yyyymm'), count(*)) from Ep_Info t where 1=1 and t.reg_Date>=to_date('2011-12','yyyy-mm') and t.reg_Date<=to_date('2014-04','yyyy-mm') group by to_char(reg_Date,'yyyy-mm'),to_char(reg_Date,'yyyymm')