MySQL

MySQL - Select Previous and Next Row

  • By Ryan
  • 08:39 pm, Nov 18, 2010

I was faced with a problem the other day in which I needed to select the previous and next row in a MySQL database. This can easily done if you are using an auto-increment field as the condition. Unfortunately, the results need to be sorted with 2 different conditions, making the auto-increment field useless. One thing I didn't want to do was use server-side programming to loop through the full dataset. This will work fine for smaller datasets, but I'm after scalability and performance. I ... Read More

Recent Articles