SELECT *
FROM mailinglist
WHERE mail_group  in ( #thisgroup#,#thatgroup#,#anothergroup#)

Wrap single qoutes around each element if mail_group is varchar datatype.

Nick Han

>>> [EMAIL PROTECTED] 03/11/04 04:33PM >>>
Hi everyone,

I've got a form with a selection box. That value is used to populate a SQL WHERE clause. As in:

SELECT *
FROM mailinglist
WHERE mail_group = '#form.group#'

Easy.

Now I need give the user the ability to have multiple selections in the  on the form, so they can choose multiple groups.  

But then I get:
WHERE mail_group = 'thisgroup,thatgroup,anothergroup'
and I get zero results.

My form variable "group" gets passed as thisgroup,thatgroup,anothergroup etc.

What I need is:
WHERE mail_group = 'thisgroup' or mail_group = 'thatgroupgroup' and so on.

Can I populate my WHERE clause from my multiple selection box?

Is there a way to do this?
Is there a better way?

-Jeff
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to