Avatar of 007programmer
007programmer
Flag for United States of America asked on

Already returning distinct values, need counts for each respective value as well

If I run this against a ML database:

let $audiences :=
for $doc in xdmp:directory("/myDirectory/")
where fn:contains($doc, 'BLAH')
return $doc/audience

for $audience in distinct-values($audiences)
return $audience

This will return the disctinct values, however I also want the counts for each of these values
XMLSQL

Avatar of undefined
Last Comment
Gertone (Geert Bormans)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Gertone (Geert Bormans)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
007programmer

ASKER
I've requested that this question be deleted for the following reason:

No suitable answers
Gertone (Geert Bormans)

Hi,
The least you can do is respond to my suggestion,
I definitely gave you code to test and debug
So I have to object closing this
Gertone (Geert Bormans)

My next suggestion would have been to have the distinct-values() on the text nodes that are descendents of the $audience. Some XQuery processors are tricky about that.
But first of course you could have tried the suggestion and could have given feedback about this.
Note that you sollicited for my time, which I voluntarily gave you, the least I can demand is feedback
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Gertone (Geert Bormans)

My recommendation:
Accept http:#a37993619
The question was "This will return the disctinct values, however I also want the counts for each of these values "
That is exactly (I tested prior to posting) what the code I posted does