[DFW.pm] Adding variables together based on commonality of different variable

Sriharsha Vedurumudi sriharsha at vedurumudi.com
Tue Mar 25 09:15:05 PDT 2014


Lisa,
     Isn't it easier for you to alter the SQL query so it gives you the 
data summed up and pre-grouped?

Regards,
sri

> Lisa Cloutier <mailto:staurofilax77 at gmail.com>
> Tuesday, March 25, 2014 12:12 PM
> Hi All,
>
> This should be easy and I've done similar things before, but I can't 
> seem to get the data structure to output properly.
>
> I have data in the following format:
>
> Market1 65000 3000
> Market1 130000  5000
> Market1 65000   4500
> Market2 65000  3000
> Market3 32000  800
> Market3 32000  1000
>
> What I need to do is get the markets so that they are unique so that I 
> can use them as hash keys.  So I need to add all of the 2nd column and 
> all of the 3rd column for each market so that there is only one entry 
> per market, with the duplicate entries all added together.
>
> The data is coming out of an arrayref (from an Oracle database) so I 
> don't have any code that shows the problem, just the foreach loop 
> iterating through each reference in the arrayref.
>
> Any help would be greatly appreciated.
>
> Thanks,
>
> Lisa
> _______________________________________________
> Dfw-pm mailing list
> Dfw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/dfw-pm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20140325/3c76dd87/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20140325/3c76dd87/attachment.jpg>


More information about the Dfw-pm mailing list