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

SQL for last year starting and ending dates - response (1) by muthm

$
0
0

That would be very close to what I wrote to your question for THIS year's starting and ending date, just that you need to subtract 1 from the year number:

select
    cast( trim( extract( year from current_date ) - 1 ) || '-01-01' as DATE )
        as first_day_of_previous_year,
    cast( trim( extract( year from current_date ) - 1 ) || '-12-31' as DATE )
        as last_day_of_previous_year;

 


Viewing all articles
Browse latest Browse all 14773

Trending Articles



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