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, and arbitrary first value is chosen from among them. min_by can be used with both numeric and non-numeric data.

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

Returns: any

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
    ]
}

Run query

Result:

min_by

87