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, an arbitrary first value is chosen from among them. MAX_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 maximized |
maximized_value | any | the value to be maximized |
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 ] }
Table 1. Results
max_by |
---|
1 |