0

I am new to influx db, please help me with query?

I have below like data in influx where same Name data (A1, A2) can be available for multiple time.

I need only latest time stamp data (row 3,4,5) if same data is available in multiple time stamp and the new data (A3). Is such query available in influx?

this query only gives one record,

SELECT time, Name, value  FROM "data"  order by time desc limit 1

enter image description here

user584018
  • 10,186
  • 15
  • 74
  • 160

1 Answers1

1

You can use the InfluxDB's last function to achieve this.

SELECT LAST("value") FROM AssetAssetType  GROUP BY "Name"
robert
  • 8,459
  • 9
  • 45
  • 70
  • how to get Name and value both? I am not getting correct output for `SELECT LAST("value"), LAST("Name") FROM AssetAssetType GROUP BY "Name"` – user584018 Oct 20 '20 at 16:07
  • GROUP BY "Name" should give both value and Name. You can try this also, SELECT "Name", LAST("value") FROM AssetAssetType GROUP BY "Name" – robert Oct 20 '20 at 16:08