你这种还是很麻烦的,有以下几种办法
1.建一个函数,返回一年中所有日的数组,然后使用
select a ,( select b from tab where dt = e.dt ) from table( ff() ) e ;
2.建一个表,表里放一年的数据.再取出来。
1.建一个函数,返回一年中所有日的数组,然后使用
select a ,( select b from tab where dt = e.dt ) from table( ff() ) e ;
2.建一个表,表里放一年的数据.再取出来。
select dd
from
(
select to_date('040101','YYMMDD')+rownum -1 dd
from <any_table_with_more_than_366_rows>
where rownum < 367
)
where to_char(dd,'YY') = '04'
;各位高手,不知有无更好的方法.
select dd
from
(
select to_date('040101','YYMMDD')+rownum -1 dd
from <any_table_with_more_than_366_rows>
where rownum < 367
)
where to_char(dd,'YY') = '04'
;各位高手,不知有无更好的方法.
create table BSYEAR (d date);
insert into BSYEAR
select to_date('20030101','yyyymmdd')+rownum-1
from all_objects
where rownum <= to_char(to_date('20031231','yyyymmdd'),'ddd');
谢谢。
能给个具体点的例子吗?