DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: SQL Help

Threaded View

  1. #2
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204
    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
    Last edited by KenEwald; 08-25-2003 at 05:17 PM.
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width