2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE IF EXISTS replace;
|
2016-06-06 18:41:28 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
CREATE TABLE replace ( EventDate Date, Id UInt64, Data String, Version UInt32) ENGINE = ReplacingMergeTree(EventDate, Id, 8192, Version);
|
|
|
|
INSERT INTO replace VALUES ('2016-06-02', 1, 'version 1', 1);
|
|
|
|
INSERT INTO replace VALUES ('2016-06-02', 2, 'version 1', 1);
|
|
|
|
INSERT INTO replace VALUES ('2016-06-02', 1, 'version 0', 0);
|
2016-06-06 18:41:28 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
SELECT * FROM replace ORDER BY Id, Version;
|
|
|
|
SELECT * FROM replace FINAL ORDER BY Id, Version;
|
|
|
|
SELECT * FROM replace FINAL WHERE Version = 0 ORDER BY Id, Version;
|
2016-06-06 18:41:28 +00:00
|
|
|
|
2019-04-16 14:13:13 +00:00
|
|
|
DROP TABLE replace;
|