2020-06-18 08:24:31 +00:00
---
2022-08-28 14:53:34 +00:00
slug: /en/sql-reference/aggregate-functions/reference/anylast
2022-04-09 13:29:05 +00:00
sidebar_position: 104
2020-06-18 08:24:31 +00:00
---
2022-08-15 17:22:10 +00:00
# anyLast
2020-06-18 08:24:31 +00:00
2024-05-04 14:20:58 +00:00
Selects the last value encountered. The result is just as indeterminate as for the [any ](../../../sql-reference/aggregate-functions/reference/any.md ) function.
**Syntax**
```sql
anyLast(column)
```
**Parameters**
- `column` : The column name.
**Returned value**
- The last value encountered.
**Example**
Query:
```sql
CREATE TABLE any_last_nulls (city Nullable(String)) ENGINE=Log;
INSERT INTO any_last_nulls (city) VALUES ('Amsterdam'),(NULL),('New York'),('Tokyo'),('Valencia'),(NULL);
SELECT anyLast(city) FROM any_last_nulls;
```
```response
┌─anyLast(city)─┐
│ Valencia │
└───────────────┘
```