0

I am trying to run a dashboard with influxdb and grafana and i would like to show only the latest values of each id e.g. if i have a table something like this

id utime
2 9:10AM
3 9:20AM
2 9:30AM
2 9:35AM
4 9:40AM
4 9:50AM

Now I would like to create a query in which it will only show me the latest result of each id and the result will show something like this below..

| 2    | 9:35AM            |
| 3    | 9:20AM            |
| 4    | 9:50AM            |

I am new to this and don't know how exactly will it work. I have tried this query below but it didn't worked.

SELECT "id", "utime" FROM "http_listener_v2" WHERE $timeFilter  GROUP BY "id" 

Can somebody please help,how can I do this?

Hsn
  • 1,168
  • 2
  • 16
  • 39
  • BTW: `InfluxQL` != `SQL`. InfluxQL offers `LAST()` - https://docs.influxdata.com/influxdb/v1.7/query_language/functions/#last , but you it needs field (not a tag). Of course you need also GROUP BY id. – Jan Garaj Jun 23 '21 at 10:25
  • Yes you are right. But I solved it by using id as a tag.. – Hsn Jun 23 '21 at 10:55

0 Answers0