How to use Group By in Marklogic?

group-by, marklogic, xquery

Solution

The short answer is to use `map:map`. See http://docs.marklogic.com/map:map for documentation, and http://blakeley.com/blogofile/archives/560/ for a longer discussion.

Problem

I want to use Group By in xquery. Can someone tell me please how to use Group By in Marklogic ?

Original source