Quote:
Originally Posted by excessnet
If I have, for exemple :
pid : 4, 24, 28, 39, 48, 59, 72
and I want to ask MySQL "from PID 24, what is the PID of the 3 next ?" and he will tell me "48"
How can I do this ?
I need to do this for something WAY bigger... more like "from PID 210589, show me the PID for the entry 100 000 later"
|
What do you mean by "100 000 later"?
Are you assuming rows will be retrieved in some particular order?
If you want to retrieve rows in order of PID, you can used the ORDER BY clause, then use LIMIT to restrict the rows retrieved after sorting.
But if you want to retrieve rows in order of insertion, you need to include a column giving the insertion order and specify that column in the ORDER BY clause.