aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/flatten_by/flatten_with_join.sql
blob: b7139810ecaa0ae06aa98cb1f4b3571a7eb5ad11 (plain) (blame)
1
2
3
4
5
6
7
8
9
/* syntax version 1 */
/* postgres can not */
$data = (select mod, aggregate_list(value) as lv from plato.Input group by cast(key as uint32) % 10 as mod);

select d.mod, d.lv, j.key
from $data as d
flatten by lv
join plato.Input as j on d.mod == cast(j.key as uint32) / 10 % 10
order by d.mod, d.lv;