1
votes

I already have InfluxDB working and getting monitoring data about some services (the value is just 1 for up and 0 for down). For the management I need to select the values from the database that are in a specific month and either night time or day time. For example: I want to select all the data from April 2019 (doesn't matter if it 1 or 0) between 08:00AM and 07:00PM (day time)

Here is what I've tried:

SELECT value FROM probe_success 
WHERE "instance" = 'https://myservice/api' AND time >= '08:00:00' AND time < '19:00:00' 
AND time >= '2019-04-01' AND time <= '2019-04-30'

But I've got an error:

{"results":[{"statement_id":0,"error":"invalid operation: time and *influxql.StringLiteral are not compatible"}]}

Can anyone tell me what I'm doing wrong or point me in the right direction?

Thank you very much!

1
Did you find a solution?Mammu yedukondalu
I had this problem 2 years ago, but they still not support OR in a WHERE statement as mentioned in the answer below. Here is what they say on their documentation page: Note InfluxDB does not support using OR in the WHERE clause to specify multiple time ranges.benny b

1 Answers

2
votes

Ok, so after some research I've found that it is not possible to use the "OR" statement in a "WHERE" clause to specify multiple time ranges. See this. I solved this problem by sending separate requests for each day in a for loop and then concatenate all the results. It's not the best solution, I admit, but since they say it's not possible I guess this is the workaround.