ClickHouse/tests/queries/0_stateless/00759_kodieg.sql

5 lines
200 B
MySQL
Raw Normal View History

2018-11-24 03:20:05 +00:00
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));