Click to See Complete Forum and Search --> : I NEED HELP - Need to have MYSQL work like excel.


airforcefc
11-24-2006, 08:01 AM
Hello,

I will give you a run down of my problem. I am creating a very simple tipping website and when people submit their tips I have them go into a database. I want to then at the end of each week be able to put in a administration area the winning tips for that week and once i submit, it will calculate the winners and losers of each tip and give a total amount of winning tips for each user for each week of tipping. I am sure there is a very simple script or something I can use to just add numbers together inside mysql.

Regards

Air

MatMel
11-24-2006, 10:05 AM
Well I don't really understand your problem, but if you want to sum to cells and store the result in a third one you'll have to use the following query:

UPDATE table_name SET c = a + b WHERE id='5'

That will sum the cell a nd b and store the result in c. Everything in the table named "table_name" and the row which has the id 5.

Of course you can use - / * and so on as well!

But be careful: it will only work on numeric cells like Integer...