utinaeniduin
01-17-2007, 05:00 AM
how can i add all the values of one column of the table to get a total?
|
||||
adding values of a single columnutinaeniduin 01-17-2007, 05:00 AM how can i add all the values of one column of the table to get a total? koyama 01-17-2007, 09:32 AM SELECT SUM(myColumn) FROM myTable WHERE 1 guelphdad 01-17-2007, 12:54 PM Note that the WHERE 1 is not necessary. utinaeniduin 01-17-2007, 04:44 PM cool. now how do i store that sum in a variable? koyama 01-17-2007, 05:02 PM I guess you are using php? $sql = "SELECT SUM(myColumn) FROM myTable"; $result = mysql_query($sql); list($sum) = mysql_fetch_row($result); // now $sum = 'the sum' |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum