ClickHouse/tests/queries/0_stateless/01582_distinct_subquery_groupby.sql

19 lines
592 B
MySQL
Raw Normal View History

DROP TABLE IF EXISTS t;
DROP TABLE IF EXISTS d;
CREATE TABLE t (a String, b Int) ENGINE = TinyLog;
INSERT INTO t VALUES ('a', 0), ('a', 1), ('b', 0);
SELECT * FROM t;
SELECT '---';
CREATE TABLE d (a String, b Int) ENGINE = Distributed(test_shard_localhost, currentDatabase(), t);
2020-11-26 09:51:55 +00:00
SELECT DISTINCT b FROM (SELECT a, b FROM d GROUP BY a, b) order by b;
DROP TABLE d;
SELECT '---';
CREATE TABLE d (a String, b Int) ENGINE = Distributed(test_cluster_two_shards_localhost, currentDatabase(), t);
2020-11-26 09:51:55 +00:00
SELECT DISTINCT b FROM (SELECT a, b FROM d GROUP BY a, b) order by b;
DROP TABLE d;
DROP TABLE t;