mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-20 07:21:02 +00:00
9 lines
344 B
SQL
9 lines
344 B
SQL
drop table if exists lc;
|
|
|
|
CREATE TABLE lc (`date` Date, `name` LowCardinality(Nullable(String)), `clicks` Nullable(Int32)) ENGINE = MergeTree() ORDER BY date SETTINGS index_granularity = 8192;
|
|
INSERT INTO lc SELECT '2019-01-01', null, 0 FROM numbers(1000000);
|
|
SELECT date, argMax(name, clicks) FROM lc GROUP BY date;
|
|
|
|
drop table if exists lc;
|
|
|