Link Search Menu Expand Document


The MIN_BY function returns the value of arg column at the row in which the val column is minimal.

If there is more than one minimal values in val, then the first will be used.


MIN_BY(arg, val)
Parameter Description
<arg> The column from which the value is returned.
<val> The column that is search for a minimum value.


For this example, we will again use the prices table that was created above for the MIN function. The values for that table are below:

item price
apple 4
banana 25
orange 11
kiwi 20

In this example below, MIN_BY is used to find the item with the lowest price.

	MIN_BY(item, price)

Returns: apple