I'm facing a problem with the nested set model, with MySQL. I can insert, delete, move subtrees to another parent, everything works fine.
But I can't figure out how to order siblings. For example, I have these siblings :
A, B, C, D, E
And I want to move B after D, obtaining this :
A, C, D, B, E
I found tons of stored procedures for inserting, deleting, etc. but not a single one to order siblings. The only one I found is a procedure for swapping siblings, but that's not what I want to achieve.
I tried to write my own one, but it seems complicated and doesn't work in all cases.
If you know how to move a node before or after one of his siblings, this would be greatly appreciated.