# MV_LAST

The MV_LAST function converts a multivalue expression into a single-valued column containing the last value. This is especially useful when working with functions that produce multivalued columns in a known order, such as `SPLIT`. The order in which multivalued fields are read from storage is not guaranteed and is frequently ascending, but you should not rely on this. If you need the maximum value, use `MV_MAX` instead, as it is optimized for sorted values and offers better performance.

## Syntax

`MV_LAST(field)`

### Parameters

#### field

A multivalue expression to be reduced to its last value.

## Examples

Extracts the last value from a semicolon-separated string in column `a` and assigns it to a new column `last_a`.

```esql
ROW a="foo;bar;baz"
| EVAL last_a = MV_LAST(SPLIT(a, ";"))
```
This example splits the string in column `a` by semicolons and returns the last value, which is `baz`.