Fritz01/18/2023, 4:07 PM
The intention is to get the latest 10 average 15minute interval reads from our sensors. The error message I get is:
SELECT device, ts, avg(measured_val) FROM sensor_data where ts > '2022-03-18' SAMPLE BY 1m ALIGN TO CALENDAR ORDER BY ts DESC LIMIT 10;
(Which I don't understand). Without the ORDER BY ts DESC the query works but I get it in ascending order, eg. 00:00, 00:15, 00:30, etc. But I'd like to retrieve it like 16:00, 15:45, 15:30, etc. (if 16:00 is the most recent entry). Am I doing it wrong? Do I need to encapsulate the query into a subquery and run an outer query just to sort? Or will this feature be added in a later release? Thanks!
"base query does not provide ASC order over dedicated TIMESTAMP column"
Bolek Ziobrowski01/18/2023, 4:36 PM
Nicolas Hourcard01/18/2023, 5:06 PM