I have a table people
id name
----+-----
54 Tango
76 Alpha
95 Radio
When displaying the records on the web those names are ordered alphabetically
Alpha, Radio, Tango
Lets say we're viewing Radio
details and want to navigate to the next (Tango)
or prevoius (Alpha)
record using some links.
How can I find those id's
to create the needed links?
Finding next superior or inferior id
won't work.
Is this possible?
Thanks.
it is not done so yet.
prev
SELECT Id FROM people WHERE name < 'Radio' ORDER BY name DESC LIMIT 1
next
SELECT Id FROM people WHERE name > 'Radio' ORDER BY name ASC LIMIT 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With