Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 13 Jun 2002 @ 18:20:36 GMT


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


Subj:   Re: Creating months table
 
From:   John Aldrin

Try this:

SELECT T2.calendar_date               AS FirstOfMonth
      ,T1.calendar_date               AS FourthThursday
  FROM (SELECT calendar_date
              ,year_of_calendar
              ,month_of_year
          FROM Sys_Calendar.Calendar
         WHERE day_of_week      = 5
           AND day_of_month     BETWEEN 22 AND 28
           AND year_of_calendar BETWEEN 1999 AND 2099) T1
      ,Sys_Calendar.Calendar                           T2
 WHERE T2.year_of_calendar   = T1.year_of_calendar
   AND T2.month_of_year      = T1.month_of_year
   AND T2.day_of_month       = 1
 ORDER BY 1;


     
  <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