Search code examples
derby

How to query data from timestamp column with delay.?


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


Solution

  • Here is the answer,

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