Mam tabele w ktorej jest jakas lista i do niej przypisany jest numer po ktorym jest sortowanie na przyklad
ID | INFO | ORDERS |
---|---|---|
1 | komunikat 1 | 3 |
2 | komunikat 2 | 2 |
3 | komunikat 3 | 1 |
4 | komunikat 4 | 4 |
Po wybraniu danych z bazy i posortowaniu bedziemy mieli
ID | INFO | ORDERS |
---|---|---|
3 | komunikat 3 | 1 |
2 | komunikat 2 | 2 |
1 | komunikat 1 | 3 |
4 | komunikat 4 | 4 |
Jak teraz zrobic ze np usuwam wpis ID=2 i chcialbym zeby komunikat 1 wskoczyl na miejsce 2 a komunikat 4 na miejsce 3
ID | INFO | ORDERS |
---|---|---|
1 | komunikat 3 | 1 |
3 | komunikat 1 | 2 |
4 | komunikat 4 | 3 |
Jest na to jakis latwy sposob ?