I have a table as follows, it has an ID and item name,order and type.
+--------+----------------+-----------+---------+
| ID | ITEM | ORDER | TYPE |
+--------+----------------+-----------+---------+
| 1 | Banana | 2 | Fruit |
+--------+----------------+-----------+---------+
| 2 | Apple | 1 | Fruit |
+--------+----------------+-----------+---------+
| 3 | Orange | 4 | Fruit |
+--------+----------------+-----------+---------+
| 4 | Lemon | 3 | Fruit |
+--------+----------------+-----------+---------+
If I were to delete say Lemon the ORDER would be 1,2,4. Is there a method to reindex the remaining items to get the following result?
+--------+----------------+-----------+---------+
| ID | ITEM | ORDER | TYPE |
+--------+----------------+-----------+---------+
| 1 | Banana | 2 | Fruit |
+--------+----------------+-----------+---------+
| 2 | Apple | 1 | Fruit |
+--------+----------------+-----------+---------+
| 3 | Orange | 3 | Fruit |
+--------+----------------+-----------+---------+
Right before you delete the
Lemonrow – check what itsORDERcolumn value is.After that perform