Use the AS operator. I know you mentioned it wasn't working, but I've yet
to see a single actual bug with AS, so I suspect it was a syntax issue.

Try:

SELECT first(mac) AS mac, first(crc_failures) AS crc_failures,
first(snr_ncc) AS snr_ncc, first(snr_rt) AS snr_rt FROM
rt_stats."default".snr_stat WHERE time > now() - 7m GROUP BY time(1m)

As for strings, currently no functions operate on strings except for
COUNT().

On Fri, Aug 12, 2016 at 3:10 AM, <[email protected]> wrote:

> Thank you for your response.
>
> I might have been wrong on the terminology, what I mean is that the
> *fields* in the measurements get renamed to first, first_1, first_2 etc.
> Which is a problem since my queries relies on them and I want to use the
> same/similar queries for downsampled data.
>
> This is an example of my data:
> snr_stat
> timecrc_failuresmacnamesnr_nccsnr_rt
> 2016-05-19T06:56:58Z 1987 "40001" "Pivatn" 144 24
> 2016-05-19T06:56:58Z 1822 "40002" "Nowuxvatn" 155 250
> 2016-05-19T06:56:59Z 1987 "40001" "Pivatn" 145 24
> 2016-05-19T06:56:59Z 1822 "40002" "Nowuxvatn" 154 250My problem is that
> "SELECT first(mac), first(crc_failures), first(snr_ncc), first(snr_rt) FROM
> rt_stats."default".snr_stat WHERE time > now() - 7m GROUP BY time(1m)"
> returns:
>
> snr_stat
> timefirstfirst_1first_2first_3
> 2016-08-12T08:57:00Z
> 4535 225 87
> 2016-08-12T08:58:00Z
> 4538 230 93
> 2016-08-12T08:59:00Z
> 4539 228 102and as you see, I've now lost the original fields names,
> which are now replaced by "first", "first_1" etc.
>
> Another problem is that the "first()" operator does only work on numerals,
> not strings...
>
> I really hope that there is a solution to this, any help would be highly
> appreciated.
>
>
> Kind regards, Peter
>
>
> fredag 12. august 2016 00.08.58 UTC+2 skrev Sean Beckett følgende:
>>
>> Did you include a "GROUP BY *" clause in the CQ? That should preserve all
>> tags. The AS keyword is used to rename items in the SELECT clause. There's
>> no need to put the tags in the SELECT clause if you are using GROUP BY *.
>>
>> On Thu, Aug 11, 2016 at 1:32 AM, <[email protected]> wrote:
>>
>>> Quick question Sean. I made an CQ like the one you mention, but my
>>> problem now is that the tags end up like:
>>> first_1first_2first_3Ideally I would want the data, and tags to be just
>>> like the source, just with lower resolution? Is that possible? (I did try
>>> the "as" operator and the tag name, but that did not work.)
>>>
>>> Regards,
>>> Peter
>>>
>>> tirsdag 2. august 2016 20.09.24 UTC+2 skrev Sean Beckett følgende:
>>>>
>>>> There are no query language operators or functions that select points
>>>> based on ordinality. The best current solution to your need is to use a CQ,
>>>> which won't introduce noticable additional storage or load, unless you are
>>>> running on a very low power device.
>>>>
>>>> CREATE CQ...
>>>>  SELECT FIRST(value) AS "60th_point" INTO bar FROM foo GROUP BY
>>>> time(1m), *
>>>> END
>>>>
>>>> That will store the point from xx:xx:00 in the new "bar" measurement.
>>>>
>>>> On Tue, Aug 2, 2016 at 8:19 AM, <[email protected]> wrote:
>>>>
>>>>> Hi guys,
>>>>>
>>>>> I'm trying to figure out how to query every n-th value of a time
>>>>> series measurement? Lets say that I store a point every second, and later
>>>>> want to query every 60th point from time x to time y?
>>>>>
>>>>> I've seen there are CQs that can make the downsampled data, but for my
>>>>> use case it does not make sense since it will only add to more load and
>>>>> storage being used. Performance wise it shouldn't be any harder/slower
>>>>> either to query 100 point that are not adjacent compared to 100 that are,
>>>>> or am I wring here?
>>>>>
>>>>> Thanks,
>>>>> Peter
>>>>>
>>>>> --
>>>>> Remember to include the InfluxDB version number with all issue reports
>>>>> ---
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "InfluxDB" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at https://groups.google.com/group/influxdb.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/influxdb/aa778b27-3257-42f
>>>>> 3-96a5-3b7c3158ad1f%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/influxdb/aa778b27-3257-42f3-96a5-3b7c3158ad1f%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Sean Beckett
>>>> Director of Support and Professional Services
>>>> InfluxDB
>>>>
>>> --
>>> Remember to include the InfluxDB version number with all issue reports
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "InfluxDB" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/influxdb.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/influxdb/d03b8f58-af24-4a3b-b240-0ad88bb27a74%40googlegroups.com
>>> <https://groups.google.com/d/msgid/influxdb/d03b8f58-af24-4a3b-b240-0ad88bb27a74%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Sean Beckett
>> Director of Support and Professional Services
>> InfluxDB
>>
> --
> Remember to include the InfluxDB version number with all issue reports
> ---
> You received this message because you are subscribed to the Google Groups
> "InfluxDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/influxdb.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/influxdb/fa7a21ac-8330-4371-979e-10b03604c9c1%40googlegroups.com
> <https://groups.google.com/d/msgid/influxdb/fa7a21ac-8330-4371-979e-10b03604c9c1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Sean Beckett
Director of Support and Professional Services
InfluxDB

-- 
Remember to include the InfluxDB version number with all issue reports
--- 
You received this message because you are subscribed to the Google Groups 
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/influxdb/CALGqCvM93twjJ%2Bx7TEABUfbQ5DnDbJXTNjNAGanR5Z-hJDN6BQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to