|
|
Archives of the TeradataForum
Message Posted: Wed, 01 Sep 2004 @ 14:10:46 GMT
Subj: | | Re: Generating week dates without sys_calendar |
|
From: | | teradatanewsgroup |
Hi,
the following will fix the Sunday / Monday problem but it still not show the correct calendar_week which can be sometimes 53 and never be
0...
Do you have the calendar week and a start date or "only" a calendar week like 2004/15? And can it be a 53?
Ulrich
SQL
select calendar_date,
day_of_week,
case when day_of_week = 1 then 7 else day_of_week - 1 end as
new_day_of_week,
week_of_year,
case when day_of_week = 1 then week_of_year - 1 else week_of_year end as
new_week_of_year
from sys_calendar.calendar
where calendar_date between '2004-12-10' and '2005-01-10'
order by 1 desc;
| |