0

I have the following data as input in kafka_consumer:

time Mode

2020-01-22T10:50:04.623699901Z ABC

2020-01-22T10:50:22.344965434Z ABC

2020-01-22T10:50:42.148796899Z ABC

2020-01-22T10:51:01.840920723Z PQR

2020-01-22T10:51:22.516903602Z PQR

2020-01-22T11:13:34.453262122Z PQR

2020-01-22T11:13:34.453309721Z ABC

I am expecting the query to give the following output:

start_time end_time Mode

2020-01-22T10:50:04.623699901Z 2020-01-22T10:50:42.148796899Z ABC

2020-01-22T10:51:01.840920723Z 2020-01-22T11:13:34.453262122Z PQR

2020-01-22T11:13:34.453309721Z 2020-01-22T11:13:34.453309721Z ABC

I want to write a select query using InfluxQL which can give me the above output. Could you please help?

  • Hi, It would be easier and faster to help you if you could tell what queries you have tried and where you are having an issue instead of asking for the whole thing. This is intended to dissuade people from getting their complete homework etc. done. – zalimgandhera Jan 27 '20 at 12:08

1 Answers1

0

As @zalimgandhera pointed out, please, do provide what you've tried. (Even if you consider the question closed, because this will help others who read this, to at least know what doesn't work)
Also providing the schema would make it easier to discuss the issue.

As far as I know it's not possible to "select" the time field in the same way you do with regular fields.

What you could do is run two queries. The first one would do a select first(field_name) ...
The second one would do a select last(field_name) ...
And then it's up to you how you handle the results
Here is the documentation for influxQL functions https://docs.influxdata.com/influxdb/v1.7/query_language/functions/#first