I have a task to do in which i have to write a query which can fetch the data on the basis of timestamp
event
and other one is Time
Derby
data base and facing issue to get the outputthis is the error i am getting from running my query in derby
error
Syntax error: Encountered "5"
my query is SELECT *
FROM test
WHERE Time >= CURRENT_TIMESTAMP - INTERVAL 5 minute
AND Time <= CURRENT_TIMESTAMP
I'm not sure about the interval syntax, but you can try TIMESTAMPADD()
:
SELECT *
FROM test
WHERE Time >= {fn TIMESTAMPADD(SQL_TSI_MINUTE, -5, CURRENT_TIMESTAMP) }
AND Time <= CURRENT_TIMESTAMP