Reputation: 1930
Is there any way to select the next 10 rows after the row with ID where rows are ordered by something.
I've come up only with simple solution like:
Thanks!
Upvotes: 3
Views: 2258
Reputation: 21657
You can use LIMIT . See the docs:
SELECT * from tableName
WHERE id > yourID
ORDER BY ID ASC
LIMIT NumRows
If the rows aren't orderd by ID, you can do:
SELECT * FROM tab1
WHERE orderColumn > (
SELECT orderColumn from tab1
WHERE id = YourId
)
ORDER BY orderColumn
LIMIT 10
Upvotes: 3