1
I don’t know how triggers work in Mysql, but in theory, you just need to decrement all the positions below the one you removed, it’s a simple SQL:
update usuarios set posicao = posicao - 1 where posicao < ?
Where "?" is the position of the user that has been removed.
Can you explain why you need this? If you use this field only for sorting there is no need to reevaluate the values.
– Genos
use these fields to perform other operations that need to be in sequence
– Robson Guedes Alves
could pick up the key from the array, the problem starts with zero
– Robson Guedes Alves
@Robsonguedesalves uses a rank for that? wouldn’t it be better!
– novic