Countdistinct is not working in query

Avatar

Avatar

priyankah586599

Avatar

priyankah586599

priyankah586599

19-02-2018

Hi,

I have the following query

var clickQuery = xtk.queryDef.create(

      <queryDef schema={vars.targetSchema} operation="select" >

          <select >                                 

             

          <node expr="distinct(@journalDistributionID)" alias="@clicksJD_id"/>

           <node expr="date(@created)" alias="@clicksDate"/>

            <node expr="count(@type)" alias="@clicksCount"  /> 

            <node expr="count([@broadLog-id])" alias="@ID" />         

                                              

          </select>

            <where>

            <condition bool-operator="AND">

           <condition expr="@type='1'" />

           <condition expr="@type!='3'" />

           </condition>

            </where>

          <orderBy/>                  

          <groupBy>

        <node expr="@journalDistributionID" />

          <node expr="date(@created)" />

        

          <node expr="@type"   />

         

         

         

          </groupBy>          

      </queryDef>    );

Unfortunately Countdistinct is not working for me. Can you pls help?

Regards,

Priyanka

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Adhiyan

Employee

Avatar

Adhiyan

Employee

Adhiyan
Employee

16-12-2019

Hi Priyanka,

 

CountDistinct as a function should work , probably the syntax for picking up broadLog-id is wrong.

If the target schema is linked to the broadLogRcp schema the syntax would be [targer/@broadlog-id] .

 

regards,

adhiyan

Answers (2)

Answers (2)

Avatar

Avatar

florentlb

Total Posts

1.1K

Likes

235

Correct Answer

239

Avatar

florentlb

Total Posts

1.1K

Likes

235

Correct Answer

239
florentlb

13-03-2018

Hi,

I don't know what can cause this. Were you able to resolve the issue since?

Florent

Avatar

Avatar

priyankah586599

Avatar

priyankah586599

priyankah586599

19-02-2018

Sorry I'm reposting my query

var clickQuery = xtk.queryDef.create(

      <queryDef schema={vars.targetSchema} operation="select" >

          <select >                                 

             

          <node expr="distinct(@journalDistributionID)" alias="@clicksJD_id"/>

           <node expr="date(@created)" alias="@clicksDate"/>

            <node expr="count(@type)" alias="@clicksCount"  /> 

            <node expr="Countdistinct([@broadLog-id])" alias="@ID" />         

                                              

          </select>

            <where>

            <condition bool-operator="AND">

           <condition expr="@type='1'" />

           <condition expr="@type!='3'" />

           </condition>

            </where>

          <orderBy/>                  

          <groupBy>

        <node expr="@journalDistributionID" />

          <node expr="date(@created)" />

        

          <node expr="@type"   />

         

         

         

          </groupBy>          

      </queryDef>    );