Skip to content

Instantly share code, notes, and snippets.

@mblakele
Created November 6, 2011 00:53
Show Gist options
  • Save mblakele/1342274 to your computer and use it in GitHub Desktop.
Save mblakele/1342274 to your computer and use it in GitHub Desktop.
W3C XQuery 3.0 - Group By Use Cases Q1
<sales-qty-by-product>{
for $sales in doc("sales-records.xml")/*/record
let $pname := $sales/product-name
group by $pname
order by $pname
return
<product name="{$pname}">{
sum($sales/qty)
}</product>
}</sales-qty-by-product>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment