Last Updated: February 25, 2016
·
459
· allankent

Toggle binary value in field

This update query toggles the value of the field binaryfield between 1 and 0 in a single update statement:

update tablename set binaryfield=(~(binaryfield&1))&(binaryfield|1) where id=...