http://lists.mysql.com/list.php?list=mysql#b
You can try this in MySQL:
SELECT company, date, SUM(sales) AS `totalsales`, SUM(cost) AS `totalcost`
FROM tablename
GROUP BY company, date
ORDER BY company, date
On Wednesday, Jul 9, 2003, at 13:59 US/Eastern, Paul Kraus wrote:
This probably is not the place for this post. But it is in a perl application so I thought I would check with you guys first.
I have to query a mysql database (using DBI)
It has records like this
Date|company|sales|cost
Each date has two records on for each of the two companies we deal with.
I need to total the two records together and display them as one result.
Date|totalsales|totalcost
I have been trying to do it with perl but wanted to make sure there wasn't some easy way to just do this in my query before doing it programmatically.
Paul
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
