I'm having a table of users positions, like position 1,2,3,4,5
. Now when any user leaves, I will delete that row and I need to update other users position with -1
.
e.g.:
If position 2 user leaves, I need to change positions like 3 to 2
, 4 to 3
, 5 to 4
, etc.
Is there any function in mysql that i can use for this type of update?
something like this might work...
update users set position = position-1 where position > 2