Fritz
01/18/2023, 4:07 PMSELECT 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;
The intention is to get the latest 10 average 15minute interval reads from our sensors.
The error message I get is:
"base query does not provide ASC order over dedicated TIMESTAMP column"
(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!Bolek Ziobrowski
01/18/2023, 4:36 PMNicolas Hourcard
01/18/2023, 5:06 PM