postgresql - How to get current month and Last month in Redshift -
i wondering if can last month , current month in redshift? looked @ functions @ http://docs.aws.amazon.com/redshift/latest/dg/r_current_date_time_functions.html
for current month, guess can following:
left(current_date, 7)
for previous month, came following:
left(add_months(current_date, -1), 7)
but wondering if there simpler way of doing these?
select extract(month current_date); select extract(month current_date - '1 month'::interval);
Comments
Post a Comment