1
How can I update a record in Mysql so that when I change a field of this record all other records change so that this field has a unique value? for example, I have a table called players and a field called artiheiro, that basically will receive a boolean value, only to say that this player is a scorer or not, and as there can be no more than one scorer player... when change some record for some record to artilheiro = 1
all other records automatically change to artilheiro = 0
It seems to me a strange solution to your problem, but if you want to solve it the way you yourself suggested you can create a
trigger
for that reason.– Sorack
the first idea that occurred to me was: first update the current scorer to 0 and then update the scorer to 1
– user60252
Why, Sorack? I should "reset" everyone before and update the specific?
– Thiago
Has any response helped solve the problem and can address similar questions from other users? If so, make sure to mark the answer as accepted. To do this just click on the left side of it (below the indicator of up and down votes).
– Sorack