Team,

I want to get the previousID and the nextID for a particular message. Is there any function in oracle for the same??.

My table read as follows:

MessageID parentID message
1 0 first
2 0 second
3 0 third
4 1 reply first
5 2 reply second
6 3 reply third

i want to get all the IDS that matches the messageID 1 and the replies to them as well, since there would be lot of replies i want the prevID of the message 0, if it have one.

Since the replies are not ordered i cannot choose messageID = messageID-1 or messageID+1.

Can anyone please please help me out
Seenu