Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

DBI, mysql, SELECT with JOIN and field names

by submersible_toaster (Chaplain)
on Feb 14, 2005 at 06:52 UTC ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found