Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using an array for the "IN" operator

Status
Not open for further replies.

Fritz21

Programmer
Feb 5, 2003
2
CA
Is there any way to pass an array into an SQL statement and use the "IN" operator to match the items in the array? Or is there another way to approach this problem. I want to search the database for certain id's that will change in number each query.
 
what language are you using to access the database? no matter which one it is, just text edit the sql statement as a string and then pass that to the database

just stuff the array values into the sql statement like this

where id in ( i, j, k, l... )

the IN list method for choosing multiple rows in one statement is very efficient, especially if the field has an index in the database


rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top