标签:blog http io ar sp on 2014 art log
create table test_leiji(rpt_month_id number(8),
current_month NUMBER(12,2));
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (200901, 380128.344363);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (200902, 274474.595772);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (200903, 309427.898521);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (200904, 379854.833875);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (201001, 380128.344363);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (201002, 274474.595772);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (201003, 309427.898521);
insert into test_leiji (RPT_MONTH_ID, CURRENT_MONTH) values (201004, 379854.833875);
select * from test_leiji t
SELECT rpt_month_id,
current_month,
SUM (current_month) OVER (PARTITION BY SUBSTR (rpt_month_id, 1, 4)order by rpt_month_id) sum_month
FROM test_leiji
order by rpt_month_id;
显示结果如图:
标签:blog http io ar sp on 2014 art log
原文地址:http://www.cnblogs.com/shengs/p/4089236.html