Skip to main content

min_by

min_by takes two arguments and returns the value of the first argument for which the value of the second argument is minimized. If multiple rows minimize the result of the second value, an arbitrary first value is chosen from among them. min_by can be used with both numeric and non-numeric data.

Returns: any

Table 1.

Parameter

Type

Description

returned_value

any

the value to be returned, when the other argument is minimized

minimized_value

any

the value to be minimized



Example

Query

PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-aggregation-sample-queries/>
PREFIX agg: <http://data.world/function/aggregate#>

SELECT (agg:minBy(?foo, ?bar) AS ?min_by)
{
    [
        :col-aggregations-foo ?foo ;
        :col-aggregations-bar ?bar
    ]
}

Try the query

Table 1. Results

min_by

87