Specify week range from Sunday to Saturday in SQL Assistance Teradata using WEEKNUMBER_OF_YEAR

Database
Fan

Specify week range from Sunday to Saturday in SQL Assistance Teradata using WEEKNUMBER_OF_YEAR

I have the code which gives me Week Number: ,'Week' ||' '||trim(WEEKNUMBER_OF_YEAR (DATA_DATE, 'ISO')) AS "WEEK of DATA_DATE"

This gives me week No as: "Week 8" (or Week 9 or Week 11) where "Week 8" Defines Days from Monday to Sunday, I am looking for days to be defined from Sunday to Saturday . DATA_DATE Format is DATA_DATE DATE FORMAT 'YY/MM/DD', Can anyone please advise on this.

Thanks, Deepak

2 REPLIES
Fan

Re: Specify week range from Sunday to Saturday in SQL Assistance Teradata using WEEKNUMBER_OF_YEAR

This works well, it starts from Week 1 (Sunday to Saturday) ,'Week' ||' '||trim(WEEKNUMBER_OF_YEAR (DATA_DATE) + 1) AS "WEEK of DATA_DATE"

rjg
Supporter

Re: Specify week range from Sunday to Saturday in SQL Assistance Teradata using WEEKNUMBER_OF_YEAR

The result you get is due to your 'ISO' specification.

Is there a reason you need 'ISO'?

 

Rglass