oracle 日累计月,Oracle按月份累计求和

原表:

0818b9ca8b590ca3270a3433284dd417.png

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')

0818b9ca8b590ca3270a3433284dd417.png

按月累计求和:

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',&#

你可能感兴趣的:(oracle,日累计月)