I am creating an end of month variable, that works with postgres but I have to rewrite it in Redshift, any clue why it shows me the following error?
The database reported a syntax error: Amazon Invalid operation: Interval values with month or year parts are not supported Details: ----------------------------------------------- error: Interval values with month or year parts are not supported code: 8001 context: i
select
(date_trunc('month', ("Date (id created)" + INTERVAL '1 month'))) as "EoM"
from id
Redshift uses dateadd to apply intervals to timestamps
select date_trunc(month, ( dateadd(month,1,"Date (id created)"))) as "EoM"
from id
see https://docs.aws.amazon.com/redshift/latest/dg/r_DATEADD_function.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With