Created
February 18, 2015 20:42
-
-
Save CliffordAnderson/0d25fcd4de6e05c85f36 to your computer and use it in GitHub Desktop.
Order by & Group by in XQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let $books := | |
<books> | |
<book class="fiction">Book of Strange New Things</book> | |
<book class="nonfiction">Programming Scala</book> | |
<book class="fiction">Absurdistan</book> | |
<book class="nonfiction">Art of R Programming</book> | |
<book class="fiction">I, Robot</book> | |
</books> | |
for $book in $books/book | |
let $title := $book/text() | |
let $class := $book/@class | |
order by $title | |
group by $class | |
return ($class, $title) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment