Search code examples
influxdbinfluxql

how to get latest timestamp data


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


Solution

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

    SELECT LAST("value") FROM AssetAssetType  GROUP BY "Name"