Influx 1.8.4 How to get the last value at a specific day?

Hi guys, I’m new here to influx and also here. I’m currently trying to get the last inserted value of a specified day. Is there any example here?

To be specific:
Get the last row value that is inserted in 25th July 2021.

Generally, I need to be able use it able to query like in SQL for testing in POSTMAN.

If you use flux you should be able to do so without too many problems as it supports date logic.

If you are using InflxQL (SQL like) there is no support for date logic, but you can get the last value of a single day by filtering the time range to cover one day only.
Another option to cover multiple days, is to filter using static timestamps from the 00:00 of the starting day to fetch the whole days interested, and then group by 24h.
note: in the lastest option avoid using relative time (ie now()-3d) as the lower filter range as it will also mess up the group by time part. (even if you write {...} GROUP BY time(1d), the database has no idea about what a day is, so it means group the result in 24h buckets, starting form the lowest specified time.

1 Like

Thanks for the reply.
Will be sticking with the single day filtering, it works though. I’m not familiar with Flux yet.
This works for me though for that particular day.
select value from test where time> ‘2021-08-09 00:00:00.000’ and time < ‘2021-08-10’;