2019-08-26 21:00:16 +00:00
|
|
|
DROP TABLE IF EXISTS ties;
|
|
|
|
CREATE TABLE ties (a Int) ENGINE = Memory;
|
|
|
|
|
2019-08-27 18:11:02 +00:00
|
|
|
INSERT INTO ties VALUES (1), (1), (2), (2), (2), (2) (3), (3);
|
2019-08-26 21:00:16 +00:00
|
|
|
|
|
|
|
SELECT a FROM ties order by a limit 1 with ties;
|
|
|
|
SELECT '*';
|
|
|
|
SELECT a FROM ties order by a limit 3 with ties;
|
|
|
|
SELECT '*';
|
|
|
|
SELECT a FROM ties order by a limit 5 with ties;
|
|
|
|
SELECT '*';
|
|
|
|
|
|
|
|
SET max_block_size = 2;
|
2019-08-27 18:11:02 +00:00
|
|
|
SELECT a FROM ties order by a limit 1, 1 with ties;
|
|
|
|
SELECT '*';
|
|
|
|
SELECT a FROM ties order by a limit 1, 2 with ties;
|
2019-08-26 21:00:16 +00:00
|
|
|
SELECT '*';
|
|
|
|
SELECT a FROM ties order by a limit 2 with ties;
|
|
|
|
SELECT '*';
|
2019-08-27 18:11:02 +00:00
|
|
|
SELECT a FROM ties order by a limit 2, 3 with ties;
|
2019-08-26 21:00:16 +00:00
|
|
|
SELECT '*';
|
|
|
|
SELECT a FROM ties order by a limit 4 with ties;
|
|
|
|
SELECT '*';
|
|
|
|
|
|
|
|
SET max_block_size = 3;
|
|
|
|
SELECT a FROM ties order by a limit 1 with ties;
|
|
|
|
SELECT '*';
|
2019-08-27 18:11:02 +00:00
|
|
|
SELECT a FROM ties order by a limit 2, 3 with ties;
|
2019-08-26 21:00:16 +00:00
|
|
|
SELECT '*';
|
2019-08-27 18:11:02 +00:00
|
|
|
SELECT a FROM ties order by a limit 3, 2 with ties;
|
2019-08-26 21:00:16 +00:00
|
|
|
SELECT '*';
|
|
|
|
|
2020-02-28 20:20:39 +00:00
|
|
|
select count() from (select number > 100 from numbers(2000) order by number > 100 limit 1, 7 with ties); --TODO replace "number > 100" with "number > 100 as n"
|
|
|
|
select count() from (select number, number < 100 from numbers(2000) order by number < 100 desc limit 10 with ties);
|
2020-03-02 12:56:47 +00:00
|
|
|
SET max_block_size = 5;
|
|
|
|
select count() from (select number < 100, number from numbers(2000) order by number < 100 desc limit 10 with ties);
|
2020-02-28 20:20:39 +00:00
|
|
|
|
2024-11-13 16:05:11 +00:00
|
|
|
SELECT count() FROM (WITH data AS (
|
|
|
|
SELECT * FROM numbers(0, 10)
|
|
|
|
UNION ALL
|
|
|
|
SELECT * FROM numbers(10, 10)
|
|
|
|
)
|
|
|
|
SELECT number div 10 AS ten, number
|
|
|
|
FROM data
|
|
|
|
ORDER BY ten
|
|
|
|
LIMIT 8,6 WITH TIES);
|
|
|
|
|
|
|
|
SELECT count() FROM (WITH data AS (
|
|
|
|
SELECT * FROM numbers(0, 10)
|
|
|
|
UNION ALL
|
|
|
|
SELECT * FROM numbers(10, 10)
|
|
|
|
)
|
|
|
|
SELECT number div 11 AS eleven, number
|
|
|
|
FROM data
|
|
|
|
ORDER BY eleven
|
|
|
|
LIMIT 8,6 WITH TIES);
|
|
|
|
|
2019-08-26 21:00:16 +00:00
|
|
|
DROP TABLE ties;
|