I'm trying to set the column ocupado
only one line at a time, something like:
update suite set ocupado = 'S' where tipo = 'i';
But this statement changes all rows in column ocupado
where tipo
is i
, and that's not what I want. I want only a single line between these to be changed to "S", the others that meet the condition should remain unchanged.
It is a reservation system, no matter which line is changed, but it should only be one that meets the above conditions. In the next execution of this query it will do with another line because it stops fulfilling the condition.
+--+-----+--------+
|id|tipo |ocupado |
+-----------------+
|01| i | N | <- alteraria só esta
|02| i | N |
|03| c | N |
|04| c | N |
+-----------------+