How to query data from timestamp column with delay.?

时间:2016-04-25 09:18:42

标签: derby

I want a query to get data from a derby table with the timestamp where time value is less than two hours to current time. following query gives and error saying

operator with a left operand type of 'TIMESTAMP' and a right operand type of 'INTEGER' is not supported.

Query:

select * from NEWS WHERE NEWS_DATE < current_timestamp-2

Appriciate any help

1 个答案:

答案 0 :(得分:2)

以下是答案,

select *from NEWS where {fn TIMESTAMPDIFF( SQL_TSI_MINUTE, NEWS_DATE,current_timestamp)} <120