mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
119 lines
921 B
Plaintext
119 lines
921 B
Plaintext
-- { echoOn }
|
|
SELECT number, sum(number) + 1 OVER (PARTITION BY number % 10)
|
|
FROM numbers(100)
|
|
ORDER BY number;
|
|
0 451
|
|
1 461
|
|
2 471
|
|
3 481
|
|
4 491
|
|
5 501
|
|
6 511
|
|
7 521
|
|
8 531
|
|
9 541
|
|
10 451
|
|
11 461
|
|
12 471
|
|
13 481
|
|
14 491
|
|
15 501
|
|
16 511
|
|
17 521
|
|
18 531
|
|
19 541
|
|
20 451
|
|
21 461
|
|
22 471
|
|
23 481
|
|
24 491
|
|
25 501
|
|
26 511
|
|
27 521
|
|
28 531
|
|
29 541
|
|
30 451
|
|
31 461
|
|
32 471
|
|
33 481
|
|
34 491
|
|
35 501
|
|
36 511
|
|
37 521
|
|
38 531
|
|
39 541
|
|
40 451
|
|
41 461
|
|
42 471
|
|
43 481
|
|
44 491
|
|
45 501
|
|
46 511
|
|
47 521
|
|
48 531
|
|
49 541
|
|
50 451
|
|
51 461
|
|
52 471
|
|
53 481
|
|
54 491
|
|
55 501
|
|
56 511
|
|
57 521
|
|
58 531
|
|
59 541
|
|
60 451
|
|
61 461
|
|
62 471
|
|
63 481
|
|
64 491
|
|
65 501
|
|
66 511
|
|
67 521
|
|
68 531
|
|
69 541
|
|
70 451
|
|
71 461
|
|
72 471
|
|
73 481
|
|
74 491
|
|
75 501
|
|
76 511
|
|
77 521
|
|
78 531
|
|
79 541
|
|
80 451
|
|
81 461
|
|
82 471
|
|
83 481
|
|
84 491
|
|
85 501
|
|
86 511
|
|
87 521
|
|
88 531
|
|
89 541
|
|
90 451
|
|
91 461
|
|
92 471
|
|
93 481
|
|
94 491
|
|
95 501
|
|
96 511
|
|
97 521
|
|
98 531
|
|
99 541
|
|
SELECT sum(number) + 1 AS x
|
|
FROM numbers(100)
|
|
GROUP BY number % 10
|
|
ORDER BY x;
|
|
451
|
|
461
|
|
471
|
|
481
|
|
491
|
|
501
|
|
511
|
|
521
|
|
531
|
|
541
|