with tt as (select
0 cc, to_date('21.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('22.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('23.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('24.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('25.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('26.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('27.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('27.05.2006','dd-mm-yyyy') date1 from dual
union
select
1 cc, to_date('28.05.2006','dd-mm-yyyy') date1 from dual)
select sum(cc) cc,
to_char(date1,'ww') week
from tt
group by to_char(date1,'ww')
|