presto sql 过滤过去 24 小时

presto sql filter last 24 hours

我正在尝试获取过滤过去 24 小时内日期的查询:

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

但是我收到这个错误:

SYNTAX_ERROR: line 3:24: Function dateadd not registered

我不认为 DATEADD 是一个 postgres 函数,你可以试试这个:

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

没关系,只是函数名不对,应该是date_add

文档: https://prestodb.io/docs/current/functions/datetime.html