Welcome Guest, Not a member yet? Register   Sign In
Update data by adding value to it
#1

[eluser]aryan_[/eluser]
I want to update like by adding some data to it. e.g. if I have a table like this

------------
id | credit
------------
1 | 5
------------
2 | 3
------------
3 | 0
------------

I want to update id 2 by adding 5 to it, so the new credit value for id 2 will be 3+5 = 8.

Basically, mathematical operation on existing data.

Please help me by providing sql or active record method. Sql preferred.

Thanks!
#2

[eluser]kgill[/eluser]
Google is your friend... http://lmgtfy.com/?q=mysql+update+data+add+number
#3

[eluser]aryan_[/eluser]
[quote author="kgill" date="1249336989"]Google is your friend... http://lmgtfy.com/?q=mysql+update+data+add+number[/quote]

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB