搞错了:(
SQL> select d2,nvl(i,0) i
2 from ( select trunc(d1) d1,sum(i) i from c group by trunc(d1)) a,
3 (select trunc(d2)+rownum-1 as d2
4 from (select min(d1) d2,max(trunc(d1))-min(trunc(d1))+1 dc from c)
5 connect by rownum <dc+1) b
6 where a.d1(+)=b.d2
7 order by d2;
SQL> select d2,nvl(i,0) i
2 from ( select trunc(d1) d1,sum(i) i from c group by d1) a,
3 (select trunc(d2)+rownum as d2
4 from (select min(d1) d2,max(trunc(d1))-min(trunc(d1)) dc from c)
5 connect by rownum<dc) b
6 where a.d1(+)=b.d2
7 order by d2;
select a.rq,sum(b.num) num
from
(select to_date('2005-03-'||rownum,'yyyy-mm-dd') rq from all_objects where rownum<=31)a
left join table1 b on a.rq=b.rq
where to_char(a.rq) between '2005-03-05' and '2005-03-09'
group by a.rq