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:
- select all
- apply a loop to find ID and then return next 10
Thanks!
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!
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