Sorry, I should have expanded on the query. The query in its entirety is:

SELECT COUNT(DISTINCT(userid)) from <measurement> WHERE time > now() - 1d 
GROUP BY building
^^ this works, however ...

The uniqueness I want to be on two fields, so below does not work. I am 
already grouping by a separate field of 'building' so your example does not 
reflect the actual condition which I unfortunately truncated in the 
original post.

SELECT COUNT(DISTINCT(userid, username)) from <measurement> WHERE time > 
now() - 1d GROUP BY building
^^ this thorws error

Thanks

-
Alan Jackson

On Wednesday, August 31, 2016 at 11:41:51 AM UTC-4, Sean Beckett wrote:
>
>
> https://docs.influxdata.com/influxdb/v0.13/query_language/functions/#distinct
>
> What you want, most likely, is 
>
> SELECT COUNT(DISTINCT(userid)) FROM...GROUP BY username
>
> On Wed, Aug 31, 2016 at 8:33 AM, <[email protected] <javascript:>> wrote:
>
>> Hello
>>
>> I am trying to create a distinct value on two fields similar to the way 
>> this is handled in PostgreSQL. i.e. SELECT DISTINCT userid, username FROM 
>> ...
>>
>> in InfluxDB DISTINCT does not appear to support multiple fields as the I 
>> ge the following when running: SELECT COUNT(DISTINCT(userid,username)) FROM 
>> ...
>>
>> ERR: error parsing query: count(distinct <field>) can only have one 
>> argument
>>
>> Is there another approach to this that will yield the same results? TIA
>>
>> -
>> Alan Jackson
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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/e6c194b8-3cd9-4cc9-a355-f18dfc241f95%40googlegroups.com
>> .
>> 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/7e4dec03-e293-499a-9c18-dab9f90d195a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to