So i have two queries to give me the information i need and im trying to figure out the best way to get the result from them. i have a table of Holdings. using:
SELECT symbol, sum(shares) AS shares, sum(shares * price) AS cost 
FROM Transactions 
WHERE (action <>5) 
    AND date <= '2010-10-30' 
GROUP BY symbol HAVING sum(shares) > 0
which results in
AGNC    50.00     1390.0000
RSO     1517.00   9981.8600
T       265.00    6668.7500
I then have another query
SELECT close FROM History WHERE symbol = $symbol AND date = $date
which will return the closing price of that day.
T    24.40
i want to basically for a given date calculate value so sum(shares * close) for each symbol. but i dont know how to do that with out looping through each row in php. i was hoping there was a join or something i could do in sql to make the data return the way i want it
 
     
     
    