I hope this isn't a stupid question but this is my best place to ask...
I have a database where I need to do a sum of a returned select...
SELECT SUM(purchases.amount_of_credit_used) WHERE customer_id="jdoe";
and do a sum of another returned select...
SELECT SUM(amount) from deposits WHERE customer_id="jdoe";
So far so good. Above two statements work fine.
The problem is I need to two sums added together and put into a third table/field (customers.balance).
shorthand I would have expected the sql statement to look something like...
UPDATE customers SET balance=( SUM( SELECT SUM(purchases.amount_of_credit_used) WHERE customer_id="jdoe", SELECT SUM(amount) from deposits WHERE customer_id="jdoe" ) ) WHERE customer_id="jdoe".
Unfortunately it does not work.
Does anyone know if what I want is possible? If so, would you be so kind as to provide sample sql statement?
Thanks!
Robert C. Best III - [EMAIL PROTECTED] District Technology Coordinator for N.E.R.I.C. at Potsdam Central School Phone: (315) 265-2000 x266
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]