max_by
max_by
takes two arguments and returns the value of the first argument for which the value of the second argument is maximized. If multiple rows maximize the result of the second value, and arbitrary first value is chosen from among them. MAX_BY can be used with both numeric and non-numeric data.
Parameter | Type | Description |
---|---|---|
| any | the value to be returned, when the other argument is maximized |
| any | the value to be maximized |
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:maxBy(?foo, ?bar) AS ?max_by) { [ :col-aggregations-foo ?foo ; :col-aggregations-bar ?bar ] }
Result:
max_by |
---|
1 |