Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

DBI, mysql, SELECT with JOIN and field names

by submersible_toaster (Chaplain)
on Feb 14, 2005 at 06:52 UTC ( #430707=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $sth = $dbh->prepare( qq|SELECT requests.id, requests.name, request
    +s.requestor, 
            requestors.name, requestors.email FROM requests LEFT JOIN 
            requestors ON requests.requestor = requestor.id| );
    my $list = $sth->fetchall_arrayref({});
    
  2. or download this
    my $sth = $dbh->prepare( 
            qq|SELECT request.id, request.daterequested, request.requestor
    +, request.producer,
    ...
            @mapto{@mapping} = @$_;
            \%mapto;
            } @$arrayref;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://430707]
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2019-07-19 21:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?