Select value ten hours ago

Hello,

I am recording price data on influx. The problem is that the price data comes every minute but sometimes for example 13.40.1 clock and other times 13.40.13 [hours,minutes,seconds].

I want to pull the last price one hour ago but if I enter this command:

select “value” from “ethereum” where “currency” = ‘usd’ and “tag” = ‘price’ and “time” = 10h

I get nothing cause the seconds are not the same from now like they from ten hours ago. You know ?

How can I fix this ?

Thanks for help and sorry for bad explaining

Cheers

Hello,

I am recording price data on influx. The problem is that the price data
comes every minute but sometimes for example 13.40.1 clock and other times
13.40.13 [hours,minutes,seconds].

I would firstly suggest that the best solution to this problem is to change the
data source which is putting these timestamps into your database so that it
ignores the seconds, and simply enters HH:MM:00 as its timestamp.

I want to pull the last price one hour ago but if I enter this command:

select “value” from “ethereum” where “currency” = ‘usd’ and “tag” = ‘price’
and “time” = 10h

I get nothing cause the seconds are not the same from now like they from
ten hours ago. You know ?

So, how about:

select “value” from “ethereum” where “currency” = ‘usd’ and “tag” = ‘price’
and “time” >= now()-600m and “time” < now()-599m

600m = 10 hours
599m = 10 hours, less 1 minute

Regards,

Antony.

Thanks so much dude :slight_smile:

But if I take 10h it will also work right ?

Sure - I just thought 600m and 599m were more obviously one minute apart,
rather than 10h and 599m (I don’t know how to combine hours + minutes in a
comparison like this, maybe possible, maybe not).

I suppose you could do “time>=now()-10h and time<now()-10h+1m”…

Antony.