Reference/Aggregations/
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:
SELECT MIN_BY(close_date, close_value) as date_of_min_sale
FROM sales_pipeline
result:
date_of_min_sale |
2017-05-22 |