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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL query for <select multiple> ???

Status
Not open for further replies.

CidneyX

Technical User
Apr 16, 2003
4
US
I have a form with a select box:

<select name=&quot;city&quot; multiple>
<option value=&quot;dallas&quot;>Dallas</option
<option value=&quot;houston&quot;>Houston</option>

In the response page i need to run a query filtering all of the selected chosen cities. What I need to do is something like this:

dim cityFilter
cityFilter=request(&quot;city&quot;)

customerList.Source = &quot;SELECT * FROM customerInfo WHERE City=&quot; & cityFilter

The problem is with the multiple values.

Since cityFilter is coming up as &quot;dallas, houston&quot;, I don't know how to form the sql statement.

Any help please?
 
Use the IN clause to accomodate multiple selections. For example:

SELECT *
FROM customerInfo
WHERE City IN ('Houston', 'Texas')



Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top