Is it possible to开发者_运维问答 invert a boolean column with just one query?
UPDATE `tablename` SET columname = !columname
try
SELECT IF (MyBoolean, 0, 1) FROM MyTable;
OR
UPDATE MyTable SET MyBoolean = IF (MyBoolean, 0, 1);
Is it possible to开发者_运维问答 invert a boolean column with just one query?
UPDATE `tablename` SET columname = !columname
try
SELECT IF (MyBoolean, 0, 1) FROM MyTable;
OR
UPDATE MyTable SET MyBoolean = IF (MyBoolean, 0, 1);
精彩评论