Would anyone have any advice on how to hardcode a specific date into my SELECT clause?
I’m trying to force a date into my query so I can reference it later, but unsure how to go about this.
Thanks in advance!
Sam
TL;DR Having issues writing a specific date into the SELECT in Athena/SQL
2
Answers
Thanks for your help all - I've managed to do what I needed to do by using this:
(CAST("date_trunc"('month', "date_add"('month', -1, current_date)) AS date)
This has locked the date I need to use until the next month rolls around and it'll then update accordingly.
Thanks for all your help!
Here are a few ways to hardcode a timestamp to a column:
If you’re using Athena engine v3.0 (Trino), you can use this reference:
https://trino.io/docs/current/functions/datetime.html
Otherwise, you’ll want the Presto documentation:
https://prestodb.io/docs/current/functions/datetime.html