time-seriesapache-iotdb

How to write the query statement to query the data few hours before the current time in Apache IoTDB?


In the sql syntax of Apache IoTDB, are there any examples of how to write the query statement of querying the data for a few hours before the current time? I tried two ways of writing but it didn’t work and failed to return the results: SELECT dev FROM root WHERE time >= NOW() -4 and time <= now(), and SELECT dev FROM root WHERE time >= NOW()- INTERVAL 4 HOUR and time <= now(). Anyone know where did I write wrong and how should I write this statement?


Solution

  • Change your WHERE clause in Apache IoTDB to WHERE time >= now() - 4h, and this should fix your query case.