...

View Full Version : How do I find a single record and the next record after it only



needsomehelp
10-03-2011, 08:56 AM
I wish to query for an entry using `Pid` and the one that follows after it, using ORDER BY `Pid`

The `Pid` is not always nubmers. There is no "index" due to this.

coiner
10-03-2011, 03:32 PM
I'm not used to working with non-numeric indexes but this should work:



SELECT * FROM the_table
WHERE Pid >= 'the_index'
ORDER BY Pid ASC
LIMIT 2;


Note that this is just going to get the two next to each other in alphabetical order, so I hope that's what you need.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum