
op:min( $outCol as item(), $inCol as item() ) as map:map
This function gets the smallest non-null value of the column for the rows in the group or row set. The result is used for building the parameters used by the op:group-by function.
| Parameters | |
|---|---|
| $outCol | The name to be used for the smallest value. |
| $inCol | The column to be aggregated. The column can be named with a string or a column function such as op:col, op:view-col, or op:schema-col, or constructed from an expression with the op:as function. |
xquery version "1.0-ml";
import module namespace op="http://marklogic.com/optic"
at "/MarkLogic/optic.xqy";
let $expenses := op:from-view("main", "expenses")
return $expenses
=> op:group-by("Category", op:min("Minimum Spent", "Amount"))
=> op:order-by("Category")
=> op:result()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.