It's possible that this is really easy and it's just Friday brain problems but I'm struggling here...
I have a MySQL table which contains text entries such as :
Elephant
Apple
Dog
Carrot
Banana
I pull one row, ie Dog. I now want to pull the previous alphabetical row and the following alphabetical row, ie Carrot & Elephant
So..
SELECT text FROM table WHERE text >= 'Dog' ORDER BY text LIMIT 1
Gives me the next alphabetical row. However,
SELECT text FROM table WHERE text <= 'Dog' ORDER BY text LIMIT 1
perhaps obviously gives me the first alphabetical row of the table. I figured I could get table position and then order alpahbetically and do a LIMIT x-1,1 to get previous but that seems awful clunky.
I'm sure I'm missing something obvious but my head hurts.
Ideas ?