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=...
Written by Allan Kent
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Mysql
Authors
Related Tags
#mysql
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#