Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: Using multiple values in a SQL "in" statement

by jhourcle (Prior)
on May 05, 2013 at 13:07 UTC ( #1032121=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Using multiple values in a SQL "in" statement
in thread Using multiple values in a SQL "in" statement

It's three operations. The x operator, is either a string or list multiplier. Here, it's being used on an list, as the item is in parens:

   ('?') x scalar(@id)

scalar(@id) gives the number of items in the array. So we end up with a list of question marks the same size as the @id array.

The join will flatten a list into a single string, placing the first argument in between each item. So we're placing a comma between each of the question marks.


Comment on Re^3: Using multiple values in a SQL "in" statement
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2015-07-06 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (74 votes), past polls