Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DISTINCT(*) and DISTINCT(*regex*) returning error #9973

Closed
NocturnalShadow opened this issue Jun 14, 2018 · 5 comments
Closed

DISTINCT(*) and DISTINCT(*regex*) returning error #9973

NocturnalShadow opened this issue Jun 14, 2018 · 5 comments

Comments

@NocturnalShadow
Copy link

NocturnalShadow commented Jun 14, 2018

Hi!
InfluxDB documentation says that I can use DISTINCT(*) in my queries without specifying fields explicitly.

On executing query from the documentation SELECT DISTINCT(*) FROM "h2o_feet"
Expected behavior: list of distinct values for distinct_level_description , distinct_water_level
Actual behavior: InfluxDB returns the following error: ERR: expected field argument in distinct()

The same error if I try to put regex inside DISTINCT.

Was this feature removed? Please, update documentation then.

InfluxDB version 1.5.1

@NocturnalShadow NocturnalShadow changed the title DISTINCT(*) returning error DISTINCT(*) and DISTINCT(*regex*) returning error Jun 14, 2018
@jsternberg
Copy link
Contributor

You can only have one distinct() call in a query so a wildcard and a regex don't make any sense. As an example:

> select distinct(usage_user), distinct(usage_system) from telegraf..cpu
ERR: aggregate function distinct() cannot be combined with other functions or fields

So you have to specify a field for distinct().

@NocturnalShadow
Copy link
Author

Sure, please, update documentation and official examples since it states opposite to what you say.

@skladd
Copy link
Contributor

skladd commented Jun 22, 2018

@jsternberg I am quite sure it used to work like stated in the documentation, now my (fairly old) CQs return errors

@dominique-mueller
Copy link

So, does anyone now how to filter out "duplicate" rows / only get "unique" rows (ignoring the timestamp)? Following the InfluxDB docs, I was hoping that a DISTINCT(*) would do the trick ...

@vennavenkatreddy
Copy link

vennavenkatreddy commented Jul 8, 2020

i am trying this SELECT DISTINCT(*) From db but getting error (experted filed argument in distinct)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants