i'm pretty sure there is a way to do this straight from a select in mysql and was wondering if anybody knew it?my $join = 'customer_id'; my $sth = $global{DBH}->prepare(" select * from voice_calls ") +; my $cth = $global{DBH}->prepare(" select * from customers wher +e $join=?"); $sth->execute(); while ( my $call = $sth->fetchrow_hashref() ) { $cth->execute( ${$call}{$join} ); my $customer = $cth->fetchrow_hashref(); $cth->finish; foreach my $key (keys %$customer) { ${$call}{$key} = ${$customer}{$key} } # end-foreach push(@{$self->{RESULTS}}, \%{$call}); } # end-while $sth->finish;
In reply to joining two tables in mysql by rsiedl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |