如何在apache钻取中使用sysdate

时间:2018-03-13 13:49:17

标签: mysql sql oracle apache apache-drill

我想通过Apache Drill运行此查询。

select * from mytable where  my_date BETWEEN sysdate-1280 AND sysdate;

2 个答案:

答案 0 :(得分:1)

select * from mytable 
where  my_date BETWEEN DATE_SUB(CURRENT_TIMESTAMP, interval '1280' day(4))
AND CURRENT_TIMESTAMP;

答案 1 :(得分:0)

您可以尝试使用current_date代替sysdate。请在此处查看有关可用时间函数的文档:https://drill.apache.org/docs/date-time-functions-and-arithmetic/#other-date-and-time-functions