very basic code which we use offten in our day to day development and sometime we stucked . i write those issue here with simple solution.
You will get codes of html, css, javascript, jquery, json,ajax, node.js, vue.js, nuxt.js, php and Mysql
Wednesday, June 24, 2015
Mysql Query to toggle int value
Hey.. want to toggle a field value
from 0 to 1 or
1 to 0 in single query..
There are Several Method
UPDATE `tbl1` SET clmn = clmn XOR 1
UPDATE `tbl1` SET clmn = 1 - clmn
UPDATE tbl1 SET `status` = !`status`
No comments:
Post a Comment