aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/aggregate/subquery_aggregation.sql
blob: b5ed8ae250636e70071f5c4e63e67b7cada02b48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* syntax version 1 */
/* postgres can not */
USE plato;

$total_count = (SELECT Count(*) from Input);

SELECT
  common,
  count(*) as rec_count,
  100. * count(*) / $total_count as part_percent
FROM Input
GROUP BY subkey as common
ORDER BY common
;