mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
4cc26aa38b
And fix execution of the query with only one grouping set
46 lines
733 B
SQL
46 lines
733 B
SQL
SELECT
|
|
k1,
|
|
k2,
|
|
SUM(number) AS sum_value,
|
|
count() AS count_value
|
|
FROM numbers(6)
|
|
GROUP BY
|
|
GROUPING SETS
|
|
(
|
|
(number % 2 AS k1),
|
|
(number % 3 AS k2)
|
|
)
|
|
ORDER BY
|
|
sum_value ASC,
|
|
count_value ASC;
|
|
|
|
SELECT
|
|
k1,
|
|
k2,
|
|
SUM(number) AS sum_value,
|
|
count() AS count_value
|
|
FROM remote('127.0.0.{2,3}', numbers(6))
|
|
GROUP BY
|
|
GROUPING SETS
|
|
(
|
|
(number % 2 AS k1),
|
|
(number % 3 AS k2)
|
|
)
|
|
ORDER BY
|
|
sum_value ASC,
|
|
count_value ASC;
|
|
|
|
SELECT
|
|
k2,
|
|
SUM(number) AS sum_value,
|
|
count() AS count_value
|
|
FROM remote('127.0.0.{2,3}', numbers(6))
|
|
GROUP BY
|
|
GROUPING SETS
|
|
(
|
|
(number % 3 AS k2)
|
|
)
|
|
ORDER BY
|
|
sum_value ASC,
|
|
count_value ASC;
|