2019-06-07 16:02:24 +00:00
|
|
|
drop table if exists limit_by;
|
2019-04-29 13:12:39 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
create table limit_by(id Int, val Int) engine = Memory;
|
2019-04-29 13:12:39 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
insert into limit_by values(1, 100), (1, 110), (1, 120), (1, 130), (2, 200), (2, 210), (2, 220), (3, 300);
|
2019-04-29 13:12:39 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
select * from limit_by order by id, val limit 2, 2 by id;
|
|
|
|
select * from limit_by order by id, val limit 2 offset 1 by id;
|
|
|
|
select * from limit_by order by id, val limit 1, 2 by id limit 3;
|
|
|
|
select * from limit_by order by id, val limit 1, 2 by id limit 3 offset 1;
|
2019-06-07 16:09:21 +00:00
|
|
|
|
|
|
|
drop table limit_by;
|