参考:如下?with t as(
select to_date('2014-02-14','yyyy-mm-dd') tdate,20 num_1 from dual
union all
select to_date('2014-02-17','yyyy-mm-dd') tdate,1 num_1 from dual
union all
select to_date('2014-02-18','yyyy-mm-dd') tdate,1 num_1 from dual
union all
select to_date('2014-02-19','yyyy-mm-dd') tdate,1 num_1 from dual
)
select to_char(tdate,'W'),sum(num_1) from t group by to_char(tdate,'W')
select to_date('2014-02-14','yyyy-mm-dd') tdate,20 num_1 from dual
union all
select to_date('2014-02-17','yyyy-mm-dd') tdate,1 num_1 from dual
union all
select to_date('2014-02-18','yyyy-mm-dd') tdate,1 num_1 from dual
union all
select to_date('2014-02-19','yyyy-mm-dd') tdate,1 num_1 from dual
)
select to_char(tdate,'W'),sum(num_1) from t group by to_char(tdate,'W')
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货