Home > Blockchain >  Getting records between current date and next x days in Presto
Getting records between current date and next x days in Presto

Time:08-12

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

CodePudding user response:

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
  • Related