This is a really crude first iteration... fixed range
select school_cd,name,start_year,start_year+1
from school
where start_year <= to_number(to_char(sysdate,'YYYY'))-3
and end_year > to_number(to_char(sysdate,'YYYY'))-3
union all
select school_cd,name,start_year+1,start_year+2
from school
where start_year <= to_number(to_char(sysdate,'YYYY'))-2
and end_year > to_number(to_char(sysdate,'YYYY'))-2
union all
select school_cd,name,start_year+2,start_year+3
from school
where start_year <= to_number(to_char(sysdate,'YYYY'))-1
and end_year > to_number(to_char(sysdate,'YYYY'))-1
order by 1,3,4
Bookmarks