aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/optimizers/yql-5978_fill_multi_usage.sql
blob: 1671816eec841fed880f7691d04e0ef621590f1a (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
26
27
28
29
/* postgres can not */
USE plato;

$ctl = (
    SELECT  1 AS join_col
            , MAX(key) AS max
    FROM Input
    );

INSERT INTO Output WITH TRUNCATE
SELECT * FROM $ctl;

$in = (
    SELECT  1 AS join_col
            , key
            , subkey
            , value
    FROM    Input
    );

SELECT 
        a.key AS key
        , a.subkey AS subkey
        , a.value AS value
FROM $in AS a
LEFT JOIN $ctl AS ctl
    USING (join_col)
WHERE key < max
;