presto sql filter last 24 hours

Viewed 10745

I'm trying to get a query that filters the date from the last 24 hours:

select *
    from tb
    where created_at > DATEADD('hour', -24, now())
    limit 100;

But I'm getting this error:

SYNTAX_ERROR: line 3:24: Function dateadd not registered
2 Answers

I don't think DATEADD is a postgres function, you could try this:

select *
   from tb
   where created_at > (now() - 24 * '1 hour')
   limit 100;
Related