ClickHouse/tests/queries/0_stateless/01323_add_scalars_in_time.sql

20 lines
438 B
MySQL
Raw Normal View History

2020-06-18 16:11:23 +00:00
DROP TABLE IF EXISTS tags;
CREATE TABLE tags (
id String,
seqs Array(UInt8),
create_time DateTime DEFAULT now()
) engine=ReplacingMergeTree()
ORDER BY (id);
INSERT INTO tags(id, seqs) VALUES ('id1', [1,2,3]), ('id2', [0,2,3]), ('id1', [1,3]);
WITH
(SELECT [0, 1, 2, 3]) AS arr1
2020-07-30 21:07:51 +00:00
SELECT arraySort(arrayIntersect(argMax(seqs, create_time), arr1)) AS common, id
2020-06-18 16:11:23 +00:00
FROM tags
WHERE id LIKE 'id%'
GROUP BY id;
DROP TABLE tags;