|
|
Archives of the TeradataForum
Message Posted: Thu, 13 Jun 2002 @ 18:20:36 GMT
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;
| |