On 4/26/2004 11:53 PM, Daniel Staal wrote:

--As of Monday, April 26, 2004 5:30 PM -0700, Christopher Lyon is alleged to have said:

So, how to I get the values to look like in variable so that I can push
them back into a new table:

New Table
name        count
---------+-------
Widgets-A|    25
Widgets-B|     10
Widgets-C|     20
Widgets-D|     10
Widgets-E|     25

Any ideas?


--As for the rest, it is mine.

Sure: create a hash, using field one as the key, and *add* (not insert) the count to the value of each element of the hash. Then store the hash in the database.

Depending on the structure of the application it may be more efficient to let the db handle it by constructing a SQL statement that does a join on the name field and creates a calculated field for the total (a.count + b.count). My SQL is rusty, but it should be pretty easy to construct with a decent reference.


Randy.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to