2019-06-04 17:03:41 +00:00
|
|
|
DROP TABLE IF EXISTS testView;
|
|
|
|
DROP TABLE IF EXISTS testTable;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS testTable (
|
|
|
|
A LowCardinality(String), -- like voter
|
|
|
|
B Int64
|
|
|
|
) ENGINE MergeTree()
|
|
|
|
ORDER BY (A);
|
|
|
|
|
2020-04-26 16:39:48 +00:00
|
|
|
INSERT INTO testTable VALUES ('A', 1),('B',2),('C',3);
|
2019-06-04 17:03:41 +00:00
|
|
|
|
|
|
|
CREATE VIEW testView AS
|
2020-04-26 16:39:48 +00:00
|
|
|
SELECT
|
2019-06-04 17:03:41 +00:00
|
|
|
A as ALow, -- like account
|
|
|
|
B
|
2020-04-26 16:39:48 +00:00
|
|
|
FROM
|
2019-06-04 17:03:41 +00:00
|
|
|
testTable;
|
|
|
|
|
|
|
|
SELECT CAST(ALow, 'String') AS AStr
|
|
|
|
FROM testView
|
2020-04-26 16:39:48 +00:00
|
|
|
GROUP BY AStr ORDER BY AStr;
|
2019-06-04 17:03:41 +00:00
|
|
|
|
|
|
|
DROP TABLE testTable;
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS testTable (
|
|
|
|
A String, -- like voter
|
|
|
|
B Int64
|
|
|
|
) ENGINE MergeTree()
|
|
|
|
ORDER BY (A);
|
|
|
|
|
|
|
|
SELECT CAST(ALow, 'String') AS AStr
|
|
|
|
FROM testView
|
2020-04-26 16:39:48 +00:00
|
|
|
GROUP BY AStr ORDER BY AStr;
|
|
|
|
|
|
|
|
INSERT INTO testTable VALUES ('A', 1),('B',2),('C',3);
|
|
|
|
|
|
|
|
SELECT CAST(ALow, 'String') AS AStr
|
|
|
|
FROM testView
|
|
|
|
GROUP BY AStr ORDER BY AStr;
|
2019-06-04 17:03:41 +00:00
|
|
|
|
|
|
|
DROP TABLE IF EXISTS testView;
|
|
|
|
DROP TABLE IF EXISTS testTable;
|