Re: Adding up query results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You should be able to do this:

select sum(quantity*price) from sale where dvd_id=1

Chris


Nathan Mealey wrote:

I hope someone can help with this frustratingly simple (I assume!) question I have.

I run this mysql query: "select sum(quantity)*price,price from sale where dvd_id=1 group by price";

I get this result:
sum(quantity)*price     price
        450.00        15.00
         29.99         29.99

I want to display the sum of the values in the first column (450.00+29.99), but I cannot figure out how to do this! Can someone clue me in?

Thanks a million,
Nathan
--
Nathan Mealey
Website Manager & Administrative Director
Cycle-Smart, Inc.
P.O. Box 1482
Northampton, MA
01061-1482
nathan@xxxxxxxxxxxxxxx
(413) 210-7984
(512) 681-7043 Fax


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux