mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 12:22:12 +00:00
fde4eb43d5
This reverts commit 6249861d16
.
10 lines
456 B
SQL
10 lines
456 B
SQL
DROP TABLE IF EXISTS users;
|
|
CREATE TABLE users (name String, score UInt8, user_level String ALIAS multiIf(score <= 3, 'LOW', score <= 6, 'MEDIUM', 'HIGH') ) ENGINE=MergeTree ORDER BY name;
|
|
|
|
INSERT INTO users VALUES ('a',1),('b',2),('c', 50);
|
|
|
|
SELECT user_level as level_alias, uniq(name) as name_alias, grouping(level_alias) as _totals
|
|
FROM remote('127.0.0.{1,2}', currentDatabase(), users)
|
|
GROUP BY GROUPING SETS ((level_alias))
|
|
ORDER BY name_alias DESC;
|