Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: DBI place holder for sub query problem

by jZed (Prior)
on Jan 02, 2008 at 19:08 UTC ( #660037=note: print w/replies, xml ) Need Help??

in reply to DBI place holder for sub query problem

Generally, placeholders can only hold the place of *values*, not structural elements like table and column names and subselect queries. You can (for most DBDs, I believe) use placeholders for values in a subquery so something like this might work:
$sth=$dbh->prepare(" UPDATE tableA SET colA =( SELECT colB FROM tableB WHERE colC=? ) WHERE tableA.rec_no=? "); foreach my $row ( @rows ) { $sth->execute( $row->{'tableB.value'}, $row->{'tableA.value'} ) or die $dbh->errstr; }
Note that the order of the values in the execute is the order of the placeholders in the SQL, not the order the tables are opened.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://660037]
[Corion]: Krug is generic pottery ware for pouring beverages, but a Bembel is painted with that blue paint and contains only (!) Apfelwein
[shmem]: Corion: alas, air too.
[Corion]: shmem: Yes, very sad!
[choroba]: doesn't sound much useful, which means I'll probably remember it
[karlgoethebier]: "that blue pain" == Salzglasur as far as i remember
[karlgoethebier]: Paint!
[shmem]: karlgoethebier the blue pain comes after all bembels are empty
[karlgoethebier]: Confusing "Bembel" with "Membel" might result in a slap in the face in Hesse...
[karlgoethebier]: shmem: Yes. Greetings from Dr. Freud
[Discipulus]: blue pain is a synōnymía

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2017-05-24 08:55 GMT
Find Nodes?
    Voting Booth?