Created
July 2, 2018 15:12
-
-
Save den-crane/f3a6a7c1f8beb61e2632729096be3fb3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table tg | |
create table tg (a Int64, b Int64, c Int64) Engine = TinyLog; | |
insert into tg values (1,1433419200,15),(1,1433332800,23),(1,1433246400,41),(1,1433160000,55), | |
(1,1432900800,24),(2,1433419200,52),(2,1433332800,23),(2,1433246400,39), | |
(2,1433160000,22),(3,1433419200,11),(3,1433246400,58) | |
select a,tupleElement(x,1) b, tupleElement(x,2) c from ( | |
select a,arrayJoin(arraySlice(groupArray(tuple(b,c)),1,3)) x from tg group by a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment