3 years ago

Toggle boolean

Posted 3 years ago by mistre83

Hi to all, my method receive an ID and i should find the row and the toggle a boolean value.

Sure, i can find the record change the value and then save it, but.. will be better to do a single update like this:

UPDATE my_model
   set flag = !flag
WHERE id = $id;

How i can do this?

Please sign in or create an account to participate in this conversation.