aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/window/win_over_few_partitions.sql
blob: 20f59940d04f783dd5700c6c50a48a735b089ea1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* postgres can not */
$data = (select
    cast(key as uint32) as age,
    cast(key as uint32)/10 as age_decade,
    cast(subkey as uint32) as region,
    value as name
from plato.Input);

select
  region, age, name, sum(age) over w1 as sum1, sum(age) over w2 as sum2
from $data
window
  w1 as (partition by region order by name),
  w2 as (partition by age_decade order by name)
order by region, age;