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

Dynamically Determine Date Range Based on System Date - response (1) by M.Saeed Khurram

$
0
0

Hi,
You can use the following query. 

SELECT  CURRENT_DATE - EXTRACT(DAY FROM CURRENT_DATE) AS PREV_MONTH , (ADD_MONTHS(PREV_MONTH, -12) +1)  PREV_MONTH_LAST_YEAR;

The ADD_MONTH Function perform date calculation intelligently and take care of days of months.
 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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