Outdated Version

You are viewing an older version of this section. View current production version.

ELT

Returns the Nth value in its list of arguments.

Syntax

ELT (pos, val, [val, [val...]])

Arguments

  • pos: one-indexed argument position
  • val: any number of values.

Examples

memsql> select elt(2, 'foo', 'bar', 'baz');
+-----------------------------+
| elt(2, 'foo', 'bar', 'baz') |
+-----------------------------+
| bar                         |
+-----------------------------+

memsql> select elt(product_code, 'housewares', 'textiles', 'appliances', 'lamps')
    ->  as product_type from products limit 6;
+-----------------------------+
| product_type                |
+-----------------------------+
| housewares                  |
| lamps                       |
| lamps                       |
| housewares                  |
| textiles                    |
| appliances                  |
+-----------------------------+