Mark k
Mark k

Reputation: 153

Getting records between current date and next x days in Presto

Hope someone can help me out. I'm trying convert a line of SQL to work with Presto. Currently in SQL I do the following to get all records that are due in the next 0-5 days:

((EventStartDate)between getdate()-1 and dateadd(day, 5, getdate()))

I thought it would be something like this in Presto

EventStartDate between current_date and interval '5' day

But get the following error in AWS Athena: Cannot check if date is BETWEEN date and interval day to second

Thanks,

Mark

Upvotes: 2

Views: 4724

Answers (1)

nbk
nbk

Reputation: 49375

Interval needs a date or timestamp to be used and BETWEEN can only be made between to equal entities to dates twp timestamps two numbers

So do this instead

 EventStartDate between current_date and current_date + interval '5' day

Upvotes: 3

Related Questions