Reputation: 6365
How can I write an sql to tell mysql to fetch the next five records starting from 5 limit 5 from a table like below.
srt_id (this is not the auto increment column even though the value is incremented)
------
1
2
3
4
5
6
7
8
9
10
So over here, I'd like to begin at 6 then end at 10. I might even want to begin at 6 or 7 or 8. I can't use offset 5 or something like that. I have to start at that row and fetch the rest. Can u pls help?
So, I tried:
select * from table where srt_id = 5 limit 5; //Begin at 5 and the next 5 records
Upvotes: 0
Views: 791
Reputation: 251
select * from table where srt_id >= 5 order by srt_id limit 5;
Upvotes: 1