PDA

View Full Version : to divide into defined number


zodehala
08-11-2009, 03:00 PM
dbname : forum
table name : name like following

id-----user-----value
1-----joe-----25
2-----sam-----47
3-----ali-----37
4-----jamal-----109
5-----abdul-----85
...
....

i want to devide all value into 10 and remainder will be value

tomws
08-11-2009, 03:41 PM
See UPDATE (http://dev.mysql.com/doc/refman/5.0/en/update.html).
Maybe something like...UPDATE `forum` SET `value`=/*your math here*/;

zodehala
08-12-2009, 12:29 PM
See UPDATE (http://dev.mysql.com/doc/refman/5.0/en/update.html).
Maybe something like...UPDATE `forum` SET `value`=/*your math here*/;


not clear

tomws
08-12-2009, 02:04 PM
not clear

explain

zodehala
08-12-2009, 03:48 PM
explain

you said

UPDATE `forum` SET `value`=/*your math here*/;


what does "/*your math here*/;" mean ?

i am asking already it

tomws
08-12-2009, 04:19 PM
The documentation for UPDATE, to which I provided a link earlier, contains this line to explain how to add 1 to a column value:
UPDATE persondata SET age=age+1;

The /*your math here*/ comment in that example is age+1. Modify and replace with your own math. The MOD function (http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_mod) will probably be useful.