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

Day Of Week or Week-Ending Function? - response (8) by jjx5nc

$
0
0

This works for computing a Friday week ending date:

CASE WHEN ((any_date - (000101 (DATE))) + 1) MOD 7 = 6 THEN any_date + 6
     ELSE   any_date + (6 - (((any_date - (000101 (DATE))) + 1) MOD 7 + 1)) END AS fri_week_ending_date


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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