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.
I don't do MySQL, but I assume it supports aggregate queries: select date, sum(sales), sum(cost) from mytable group by date In general, you want to have the database server do this kind of aggregation rather than doing it in your client application. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
