3,491
社区成员
发帖
与我相关
我的任务
分享
select t.dt, count(1)
from (select to_date('2009-07-01', 'yyyy-mm-dd') - 1 + rownum dt
from all_objects
where rownum <= to_date('2009-07-05', 'yyyy-mm-dd')
- to_date('2009-07-01', 'yyyy-mm-dd')
+ 1
) t,
A a
where t.dt = a.dt(+)
group by t.dt;
select t.dt, count(1)
from (
select to_date('2009-07-01', 'yyyy-mm-dd') - 1 + rownum dt
from dual
connect by rownum <= to_date('2009-07-05', 'yyyy-mm-dd')
- to_date('2009-07-01', 'yyyy-mm-dd')
) t,
A a
where t.dt = a.dt(+)
group by t.dt;
[Quote=引用 5 楼 shiyiwan 的回复:]select t.dt, count(1)
from (SELECT begin_date + level -1 dt FROM test connect BY begin_date + level -1 <= end_date) t,
A a
where t.dt = a.dt(+)
group by t.dt;