Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-21152

[CX] Distinct keyword in Count function gives error

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • CBAS DP4
    • CBAS DP
    • analytics
    • None
    • Untriaged
    • Unknown
    • CX Sprint 71

    Description

      Query issued:
      SELECT job_title, SUM(test_rate) % COUNT(distinct join_yr) as avg_per_year from default_shadow group by job_title;
       
      Error:
      	"msg": "Syntax error: In line 1 >>SELECT job_title, SUM(test_rate) % COUNT(distinct join_yr) as avg_per_year from default_shadow group by job_title;<< Encountered '(' \"(\" at column 41. "
       
       
      Above query works well in n1ql.
      When I remove distinct keyword in count function I get:
      	"msg": "Cannot resolve ambiguous alias reference for undefined identifier test_rate"
       
      Also I am able to select DISTINCT job_title from default_shadow, so distinct is supported and works well separately but not in count function.
      
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              dmitry.lychagin Dmitry Lychagin (Inactive)
              Prerna.Manaktala Prerna Manaktala (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty