I am writing a query in InfluxDB where my measurement have multiple tags. I would like to group by on a particular tag and time and do a mean on a field and also get the last value in that group for another tag value.
For example:
I have 2 tags: tag1 and tag2 and a field field1.
I would like to GROUP BY on tag1 and do a mean on field1 and take the last value of tag2.
For this when I write a query like this, I do not get the tag value:
SELECT mean(field1), last(tag2) FROM "measurement" GROUP BY tag1
Please let me know if I am doing something wrong. My tag2 value is a string field.