Kris B
Kris B

Reputation: 3578

Return last rows from specific row

I'm trying to return the rows that come after a specific row:

ID      Title
1       "Title 1"
2       "Title 2"
3       "Title 3"
4       "Title 4"
5       "Title 5"
6       "Title 6"
7       "Title 7"
8       Title 8
9       Title 9
10      Title 10

So, given ID of 5, I'd like to return rows 6,7,8,9,10

This is what I've tried, so far: SELECT * FROM (SELECT * FROM [table] ORDER BY ID DESC LIMIT 10) ORDER BY ID ASC;

Upvotes: 0

Views: 43

Answers (1)

Kerri
Kerri

Reputation: 301

If your IDs are always incrementing you can use the following:

SELECT * FROM [table] WHERE ID > [number]

Upvotes: 1

Related Questions