# ELT

## Syntax

```sql
ELT(N, str1[, str2, str3,...])
```

## Description

Takes a numeric argument and a series of string arguments. Returns the string that corresponds to the given numeric position. For instance, it returns `str1` if `N` is 1, `str2` if `N` is 2, and so on. If the numeric argument is a [FLOAT](https://mariadb.com/docs/server/reference/data-types/numeric-data-types/float), MariaDB rounds it to the nearest [INTEGER](https://mariadb.com/docs/server/reference/data-types/numeric-data-types/integer). If the numeric argument is less than 1, greater than the total number of arguments, or not a number, `ELT()` returns `NULL`. It must have at least two arguments.

It is complementary to the [FIELD()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/field) function.

## Examples

```sql
SELECT ELT(1, 'ej', 'Heja', 'hej', 'foo');
+------------------------------------+
| ELT(1, 'ej', 'Heja', 'hej', 'foo') |
+------------------------------------+
| ej                                 |
+------------------------------------+

SELECT ELT(4, 'ej', 'Heja', 'hej', 'foo');
+------------------------------------+
| ELT(4, 'ej', 'Heja', 'hej', 'foo') |
+------------------------------------+
| foo                                |
+------------------------------------+
```

## See also

* [FIND\_IN\_SET()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/find_in_set) function. Returns the position of a string in a set of strings.
* [FIELD()](https://mariadb.com/docs/server/reference/sql-functions/string-functions/field) function. Returns the index position of a string in a list.

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/string-functions/elt.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
