标签:-- string creat nbsp tree into engine sum tab
create table test.t_20210429 ( app String, cnt Nullable(UInt32), per Nullable(UInt32) ) ENGINE=MergeTree() order by app; insert into test.t_20210429 values(‘a‘,100,200),(‘a‘,50,123),(‘b‘,1,1); ------------------------------------------------------------------------------------------------------------- SELECT c1,c2 FROM ( SELECT groupArray([cnt, per])[1] AS arr_1,[‘cc1‘, ‘cc2‘] AS arr_2 FROM ( SELECT sum(cnt) AS cnt,sum(per) AS per FROM test.t_20210429 WHERE app = ‘a‘ GROUP BY app ) AS A ) AS B ARRAY JOIN arr_1 AS c1, arr_2 AS c2 ;
create table test.t_20210429(app String,cnt Nullable(UInt32),per Nullable(UInt32))ENGINE=MergeTree()order by app;
insert into test.t_20210429 values(‘a‘,100,200),(‘a‘,50,123),(‘b‘,1,1);
SELECT c1,c2FROM ( SELECT groupArray([cnt, per])[1] AS arr_1,[‘cc1‘, ‘cc2‘] AS arr_2 FROM ( SELECT sum(cnt) AS cnt,sum(per) AS per FROM test.t_20210429 WHERE app = ‘a‘ GROUP BY app ) AS A) AS BARRAY JOIN arr_1 AS c1, arr_2 AS c2 ;
标签:-- string creat nbsp tree into engine sum tab
原文地址:https://www.cnblogs.com/muyue123/p/14719308.html