Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

How to go last week of end date ? - response (1) by dnoeth

$
0
0

Did you reading/answer the old post instead of opening a new one?
Why do you use a very old version, 12.0.0.03, which is definitely no production system?
dayofweek is based on a week starting on sunday not monday, you have to adjust your logic based on this (i already posted a SQL UDF with a calculation to get a begin of a week based on ISO).
As i wrote, since 13.10 you could easily do a SQL UDF and for 14 there's a DAYNUMBER_OF_WEEK:

SELECT current_date as d, 
  d - DAYNUMBER_OF_WEEK(d,'iso'),
  d - d-((dayofweek(d) + 5) MOD 7 + 1)

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>