aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/optimizers/test_no_aggregate_split.sql
blob: a5baec070e164f949b61b6866845e212f49b0c83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* postgres can not */

$aggregated = (
    SELECT Group, Name, SUM(Amount) AS TotalAmount
    FROM plato.Input1
    GROUP BY Group, Name
);

SELECT t.Comment, a.TotalAmount
FROM plato.Input1 AS t
INNER JOIN $aggregated AS a
ON t.Group == a.Group AND t.Name == a.Name
ORDER BY t.Comment, a.TotalAmount;

SELECT TotalAmount FROM $aggregated ORDER BY TotalAmount;