mistre83
2 years ago

Toggle boolean

Posted 2 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.