mysql query: UPDATE database SET this=this+2 WHERE this greater than value;

RegisterLogin
mysql query: UPDATE database SET this=this+2 WHERE this greater than value;
Post Description: mysql query: UPDATE database SET this=this+2 WHERE this greater than value;
Tags: mysql, query:, UPDATE, database, SET, this=this+2, WHERE, this, greater, than, value;
This Post Was Posted On Feb 29, 2008 By web hosting #1491
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

Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2011 Webune Forums - Sun Dec 18, 2011 7:59 pm
Powered by: Webune Forums V3