Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 19 Dec 2006 @ 21:56:23 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Finding the last Friday of the year
 
From:   Stone, Randall

  How about this:  


          > select
          >  *
          > from
          >  sys_calendar.calendar as c
          > where
          >  c.year_of_calendar = 2006 and
          >  c.month_of_year = 12 and
          >  c.day_of_month > 24 and
          >  c.day_of_week = 6
          > ;

I modified your code a little bit so you don't have to re-write it every year:

     select
      *
     from
      sys_calendar.calendar as c
      inner join (select extract(year from date) as current_year) ref
      on
      c.year_of_calendar = ref.current_year
      AND c.month_of_year = 12
      AND c.day_of_month > 24
      AND c.day_of_week = 6;

Randall Stone



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023