Assigning week number with weekending on Sundays..

UDA

Assigning week number with weekending on Sundays..

I have a requirement where in i have to assign weeknumbers starting from 1.
The weeks would end on Sundays.
This needs to be done for year 2009.But the 1st day of 2009 didn't start on monday.So if we consider that week monday fell on 29th Dec.
So i want to assign that week as week no 1 and so on..

Please let me know how it can be done in TD.

Thanks in advance.
1 REPLY
Teradata Employee

Re: Assigning week number with weekending on Sundays..

Try this:

sel
calendar_date as Date_Sunday
,'Sunday' as Day_of_the_Week
,week_of_year as week_number
from sys_calendar.calendar
where year_of_calendar = 2009
and day_of_week = 1
group by 1,2,3