Search code examples
apache-iotdb

How to query the complete latest row (not separately for each field) of data under different devices in one command of Apache IoTDB?


How to query the latest set of data records under each device at one time in Apache IoTDB? I know IoTDB can check the latest data using last_value, but the result coming back did not return the complete latest row of data, but only with the latest values of different fields. Therefore, I want to know if I want to check the entire row of data, how should I write my query statement?


Solution

  • You can try select last_value(*), MAX_TIME(*) from root.dc.* where time >= now() -1d align by device statement in Apache IoTDB. There's no direct way to find the latest row of data, but can find the latest non-null value and the latest (maximum) time for each time series of the devices. See if this gives you all the information you need.