in reply to Combine data in table
Otherwise, to do it in perl, you would loop over the rows, hashing on the IP. Something like:SELECT colIP, SUM(colPartitionSize) as size, SUM(colPartitionFree) as free FROM table_name GROUP BY colIP
my $rows = ...; # ref to AoH my %ips; foreach my $row (@$rows){ $ips{ $row->{colIP} }->{ colPartitionSize } += $row->{colPartitionSi +ze}; $ips{ $row->{colIP} }->{ colPartitionFree } += $row->{colPartitionFr +ee}; } print Dumper \%ips;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Combine data in table
by DrAxeman (Scribe) on Aug 07, 2005 at 18:02 UTC | |
by davidrw (Prior) on Aug 07, 2005 at 18:09 UTC | |
by DrAxeman (Scribe) on Aug 07, 2005 at 19:10 UTC | |
by davidrw (Prior) on Aug 07, 2005 at 19:30 UTC | |
by DrAxeman (Scribe) on Aug 07, 2005 at 19:49 UTC | |
| |
by DrAxeman (Scribe) on Aug 07, 2005 at 23:25 UTC | |
by davidrw (Prior) on Aug 08, 2005 at 01:19 UTC |