
Originally Posted by
samanime
Okay, now that I know the question. =p
The simplest way to do this would be to do a SELECT query and get all of the elements, ordered by ID. Then just go through and do an UPDATE on each one, changing the ORDER to an ever incrementing value.
However, there are two potentially better ways to do this:
- If the ID and ORDER are always related, then why have order? Just arrange stuff based on ID.
- When you remove a single row, you could do an UPDATE SET ORDER = ORDER - 1 WHERE ORDER > removedOrder.
If I knew more what you were doing with this I could help a bit more.
Bookmarks