Hi All. I have a table called 'note' . In the 'note' table, I have id , subject and content . The id is set on autoincrement and it's of int format.
I need to find the next and previous of the current id . E.g , current id = 7.
I need to find the next and the previous of id 7. How do I do it .
One more thing , in autoincrement , if you delete off one id , it would not rearrange itself into the blank space. e.g. id 4,5,6,7,10 .If I delete off id 5,
then I would have 4,6,7,10 left in the table. If I use 'select * from note where id= ? ++;' and if the current id is 4 , the next id is 5 but 5 have been deleted or if the current id is 7 , there is no id 8 or 9 but only 10.
So essentially, how do I write the code for finding the next and previous ?
I am also using JDBC for my Java Application for writing this codes above.