aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Optimizers/MultiExtractMembersOverReadTable.sql
blob: 3e7b24508ad663bbd25fac30693eab9ea734bd88 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
$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;