ClickHouse/tests/queries/0_stateless/00453_top_k.sql

16 lines
358 B
MySQL
Raw Normal View History

SELECT topK(10)(n) FROM (SELECT if(number % 100 < 10, number % 10, number) AS n FROM system.numbers LIMIT 100000);
SELECT
k,
topK(v)
FROM
(
SELECT
number % 7 AS k,
arrayMap(x -> arrayMap(x -> if(x = 0, NULL, toString(x)), range(x)), range(intDiv(number, 1))) AS v
FROM system.numbers
2020-12-12 12:08:46 +00:00
LIMIT 10
)
GROUP BY k
2020-12-06 19:16:21 +00:00
ORDER BY k ASC