mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-16 20:53:27 +00:00
5 lines
200 B
MySQL
5 lines
200 B
MySQL
|
SELECT
|
||
|
[1, 2, 3, 1, 3] AS a,
|
||
|
indexOf(arrayReverse(arraySlice(a, 1, -1)), 3) AS offset_from_right,
|
||
|
arraySlice(a, multiIf(offset_from_right = 0, 1, (length(a) - offset_from_right) + 1));
|