- Forums
- MYSQL
- mysql query: UPDATE database SET this=this+2 WHERE this greater than value;
This Page Contains information about mysql query: UPDATE database SET this=this+2 WHERE this greater than value; By web hosting in category MYSQL with 0 Replies. [2280], Last Updated: Mon Jun 24, 2024
web hosting
Fri Feb 29, 2008
0 Comments
354 Visits
this is just an example of how you can do many things in a single mysql query:
lets say i have a mysql table where one of my colums is rank and i want to change the ranking to two levels up in each row but i only want it where the row have a money greater than 500, i would follow this:
UPDATE database SET this=this+2 WHERE this greater than value
so mysql query would look like this:
PHP CODE:
$money_limit = "500";
$sql = "UPDATE table SET `rank`=`rank`+2 WHERE `left` > ".$money_limit;
this short tutorial brought to you by www.webune.com
PHP/MYSQL WEB HOSTING