Clickhouse: How can get correct array ?

Created on 4 Nov 2020  Β·  2Comments  Β·  Source: ClickHouse/ClickHouse

sql :
WITH
[1, 2, 3] AS d1,
['a', 'e', 'f'] AS t1
SELECT
arrayJoin(d1),
arrayJoin(t1)

β”Œβ”€arrayJoin(d1)─┬─arrayJoin(t1)─┐
β”‚ 1 β”‚ a β”‚
β”‚ 1 β”‚ e β”‚
β”‚ 1 β”‚ f β”‚
β”‚ 2 β”‚ a β”‚
β”‚ 2 β”‚ e β”‚
β”‚ 2 β”‚ f β”‚
β”‚ 3 β”‚ a β”‚
β”‚ 3 β”‚ e β”‚
β”‚ 3 β”‚ f β”‚

it's not I want result, how can I get result as :
1 a
2 e
3 f
?

question question-answered

All 2 comments

WITH [1, 2, 3] AS a, ['a', 'b', 'c'] AS b SELECT arrayJoin(arrayZip(a, b))

SELECT d, t from ( WITH
[1, 2, 3] AS d1,
['a', 'e', 'f'] AS t1 select d1, t1)
array Join d1 as d, t1 as t

β”Œβ”€d─┬─t─┐
β”‚ 1 β”‚ a β”‚
β”‚ 2 β”‚ e β”‚
β”‚ 3 β”‚ f β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”˜
Was this page helpful?
0 / 5 - 0 ratings

Related issues

healiseu picture healiseu  Β·  3Comments

jangorecki picture jangorecki  Β·  3Comments

bseng picture bseng  Β·  3Comments

vixa2012 picture vixa2012  Β·  3Comments

igor-sh8 picture igor-sh8  Β·  3Comments