I have a table with a column designated for ordering page content. I was wondering what SQL I could use to auto-increment/auto-decrement order numbers in a column. For example if my columns looked like this:
...and I want to change the page order for pageId 3 to be 5, then all the page orders greater than pageorder of 3 will be decremented until the updated pageorder of 5. This will now look like this:
Can someone please help with this? Thank you
regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
Code:
PageId PageOrder
------ ----------
1 1
2 2
3 3
4 4
5 5
6 6
7 7
...and I want to change the page order for pageId 3 to be 5, then all the page orders greater than pageorder of 3 will be decremented until the updated pageorder of 5. This will now look like this:
Code:
PageId PageOrder
------ ----------
1 1
2 2
3 5
4 3
5 4
6 6
7 7
Can someone please help with this? Thank you
regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.