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

How to go last week of end date ? - forum topic by malli123

$
0
0

Hi,
I need to pull the last week end date where my week stat day is 'monday' and END day is 'Sunday'. When i am running below query it is working fine for all days except for Monday. Please find the results. I am using TD 12.0.0.03 ver
select distinct date '2013-12-23'-dayofweek(date '2013-12-23'-2)-1 from fact;
ans : 12/15/2013
select distinct date '2013-12-24'-dayofweek(date '2013-12-24'-2)-1 from fact;
12/22/2013
select distinct date '2013-12-25'-dayofweek(date '2013-12-25'-2)-1 from fact;
12/22/2013
12/22/2013 is the last week end date .
 
Please help me to right a query which will works for all the days to go last week end.
 
Thanks in advance !
 

Forums: 

Viewing all articles
Browse latest Browse all 14773

Trending Articles



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