2022-05-12 16:39:50 +00:00
|
|
|
SELECT
|
|
|
|
number,
|
|
|
|
grouping(number, number % 2, number % 3) AS gr
|
|
|
|
FROM numbers(10)
|
2022-05-18 15:23:31 +00:00
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
|
|
|
ORDER BY number, gr; -- { serverError BAD_ARGUMENTS }
|
|
|
|
|
2022-05-25 21:23:35 +00:00
|
|
|
-- { echoOn }
|
2022-05-18 15:23:31 +00:00
|
|
|
SELECT
|
|
|
|
number,
|
|
|
|
grouping(number, number % 2) AS gr
|
|
|
|
FROM numbers(10)
|
2022-05-12 16:39:50 +00:00
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
|
|
|
ORDER BY number, gr;
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
number,
|
2022-05-18 15:23:31 +00:00
|
|
|
grouping(number % 2, number) AS gr
|
2022-05-12 16:39:50 +00:00
|
|
|
FROM numbers(10)
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
|
|
|
ORDER BY number, gr;
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
number,
|
2022-05-18 15:23:31 +00:00
|
|
|
grouping(number, number % 2) = 1 AS gr
|
2022-05-12 16:39:50 +00:00
|
|
|
FROM numbers(10)
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
|
|
|
ORDER BY number, gr;
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
number
|
|
|
|
FROM numbers(10)
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
2022-05-18 15:23:31 +00:00
|
|
|
ORDER BY number, grouping(number, number % 2) = 1;
|
2022-05-12 16:39:50 +00:00
|
|
|
|
|
|
|
SELECT
|
|
|
|
number,
|
|
|
|
count(),
|
2022-05-18 15:23:31 +00:00
|
|
|
grouping(number, number % 2) AS gr
|
2022-05-12 16:39:50 +00:00
|
|
|
FROM numbers(10)
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number, number % 2),
|
|
|
|
()
|
|
|
|
)
|
|
|
|
ORDER BY (gr, number);
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
number
|
|
|
|
FROM numbers(10)
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
2022-05-18 15:23:31 +00:00
|
|
|
HAVING grouping(number, number % 2) = 2
|
2022-05-12 16:39:50 +00:00
|
|
|
ORDER BY number
|
|
|
|
SETTINGS enable_optimize_predicate_expression = 0;
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
number
|
|
|
|
FROM numbers(10)
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2)
|
|
|
|
)
|
2022-05-18 15:23:31 +00:00
|
|
|
HAVING grouping(number, number % 2) = 1
|
2022-05-12 16:39:50 +00:00
|
|
|
ORDER BY number
|
|
|
|
SETTINGS enable_optimize_predicate_expression = 0;
|
2022-05-13 18:20:12 +00:00
|
|
|
|
|
|
|
SELECT
|
|
|
|
number,
|
2022-05-18 15:23:31 +00:00
|
|
|
GROUPING(number, number % 2) = 1 as gr
|
2022-05-13 18:20:12 +00:00
|
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
|
|
GROUP BY
|
|
|
|
GROUPING SETS (
|
|
|
|
(number),
|
|
|
|
(number % 2))
|
|
|
|
ORDER BY number, gr;
|