- 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 wallpaperama in category MySQL with 0 Replies. [888], Last Updated: Sat May 18, 2024
wallpaperama
Mon Feb 18, 2008
0 Comments
1720 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