如果还要出现统计值为0的行的话就这样写:
select a."周数",to_char(:start_date + a."周数" * 7 - 7,'mm/dd')||'-'||to_char(:start_date + a."周数" * 7 - 1,'mm/dd') as "日期",nvl("统计值",0) as "统计值" from
(select rownum as "周数" from yourtable where rownum <= ceil((:end_date - :start_date) / 7)) a,
(select ceil((createtime - :start_date) / 7) as "周数",count(*) as "统计值" from yourtable group by ceil((createtime - :start_date) / 7)) b
where a."周数" = b."周数"(+);
上面语句不够精确,时间界线可能还有问题,你可微调一下。
另外如果你专门建一个周数表就不用从yourtable中选rownum了。