Archives of the TeradataForum
Message Posted: Tue, 19 Dec 2006 @ 21:56:23 GMT
Subj: | | Re: Finding the last Friday of the year |
|
From: | | Stone, Randall |
> 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
|