Skip to main content

Posts

Showing posts from December, 2014

update issue in mysql

update table temp set `a`=`a`+1 , `b`= `a`+ 1;

this query sometimes doesn't yield the result we are actually looking for..
so the problem is `a` is getting updated first.

So, the actual query should be :
update table temp set `b`= `a`+ 1, `a`=`a`+1 ;