blob: b89caf963f5c67ac9cb156ae9b74bbd4d97ee9cb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* syntax version 1 */
/* postgres can not */
pragma AnsiCurrentRow;
SELECT
value,
key,
subkey,
SUM(cast(subkey as Int32)) over w as subkey_sum_ansi,
SUM(cast(subkey as Int32)) over w1 as subkey_sum,
SUM(cast(subkey as Int32)) over w2 as subkey_sum_next,
FROM plato.Input
WINDOW w AS (
PARTITION BY value
ORDER BY key
), w1 AS (
PARTITION BY value
ORDER BY key
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), w2 AS (
PARTITION BY value
ORDER BY key
ROWS BETWEEN UNBOUNDED PRECEDING AND 1 FOLLOWING
)
ORDER BY value, key, subkey;
|