4
I have a table that has numerous records and a column called posição
.
It only gets the value 0 for locked and 1 for released.
There now with a change I need to reverse these values, where this 0 has to be 1 and where this 1 has to be 0.
How do I do it in update
mysql?
So I don’t know how to do this update. The table is called Orders and the column in question is called position as I said above. In this column only accept 0 and 1 in the values I need to run an update that reverses them. Where position=1 has to be position=0 and where position=0 has to be position=1. I hope I’ve been able to explain better.
– Joao Nivaldo
@But Joaonivaldo is exactly what is in the answer, no?
– Bacco
@Joaonivaldo, the answer is correct. When
posicao
is equal to 0, the update will do the account1 - 0
which is equal to 1 (reversed from 0 to 1). Ifposicao
is equal to 1, the update will do the account1 - 1
equal to 0 (reversed from 1 to 0).– Dherik
It was perfect. It is that the first time I saw it was written table where appeared position so I did not understand. Ai after I had responded appeared to your edition. Thank you very much
– Joao Nivaldo