Sample Header Ad - 728x90

InfluxDB: selecting last() values from different tags

1 vote
1 answer
3612 views
I have a bucket with the raw data of several sensors, things like temperature, air pressure and etc. The sensors don't send their data at the same time, which means that a given timestamp might have several data points from various sensors or just from just one. Each reading is tagged with the ID of the sensor it comes from. I need to get the Last() reading from a given number of IDs. When I try this code:
select last(Temperature) from raw_measure where ID =~ /4372502|4399699|4406512|4407840/
instead of returning the last Temperature observation of each ID, it returns the most recent temperature timestamp of the whole group. How can I get the last reading of each ID in a single query?
Asked by John D. (21 rep)
Feb 16, 2021, 04:00 PM
Last activity: Feb 19, 2021, 01:22 AM