DateDiff Error - Show only Past 15 mins of Data

I am running a query in which I would like to use the timestamp column to only show results from the last 15 minutes. I have checked this code on other platforms and it works fine. I think Dremio does not like the DateDiff Function.

SELECT *

FROM Table

WHERE DATEDIFF(MINUTE, [DateTimeColumn], getdate()) <= 15

I have also tried these, all of them give Syntax errors.

SELECT *
FROM Table
WHERE DateTimeColumn > NOW() - INTERVAL 15 MINUTE;

SELECT *
FROM Table
WHERE DateTimeColumn >= DATEADD(MINUTE, -15, GETDATE())
AND DateTimeColumn <= GETDATE()

Something like this?

SELECT NOW() - INTERVAL '15' MINUTE;

1 Like