Invert value 0 or 1 in a column

4

I have a table that has many records and a column called posição .

It only receives the value 0 for blocked and 1 for released.

Now with a precise change, invert these values, where this has to be 1 and where this 1 has to be 0.

How do I do this in update of MySQL?

    
asked by anonymous 11.04.2015 / 01:14

1 answer

5

This is probably what you need:

UPDATE Pedidos SET posicao = 1 - posicao;
    
11.04.2015 / 01:23