Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: DBI select IN Array

by clueless newbie (Deacon)
on Feb 20, 2019 at 15:21 UTC ( #1230257=note: print w/replies, xml ) Need Help??


in reply to DBI select IN Array

Use the pram/baby cart, young Jedi!
my @tagList=('red','black'); my $sql="SELECT table FROM tags WHERE tag IN (@{[join(', ', ('?') x @t +agList)]})"; print $sql,"\n";
yields
SELECT table FROM tags WHERE tag IN (?, ?)

Replies are listed 'Best First'.
Re^2: DBI select IN Array
by Tux (Abbot) on Feb 20, 2019 at 15:41 UTC

    Or use $":

    local $" = ","; my $sql = "select table from tags where tag in (@{[('?')x@taglist]})";

    Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230257]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2019-12-10 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?