popeus
Programmer
- Dec 13, 2000
- 21
I need to query a list against a list in the db field.
Example:
<cfqery name="MyQuery" datasource="application.ds">
select MyField
from DbTable
where cat,dog,fish,bird LIKE '%form.cat,form.dog%'
</cfquery>
The above is a rough example, but I have a select box on a form where you can select multiple criteria. For instance
<select name="animal" size="4" multiple>
<option value="cat">cat</option>
<option value="dog">dog</option>
<option value="fish">fish</option>
<option value="bird">bird</option>
</select>
If you select only one of the options the query works. If you select more than one option you get 0 results.
I need to do this at the query level and not loop over the results.
Any help would be greatly appreciated.
Thank you
Example:
<cfqery name="MyQuery" datasource="application.ds">
select MyField
from DbTable
where cat,dog,fish,bird LIKE '%form.cat,form.dog%'
</cfquery>
The above is a rough example, but I have a select box on a form where you can select multiple criteria. For instance
<select name="animal" size="4" multiple>
<option value="cat">cat</option>
<option value="dog">dog</option>
<option value="fish">fish</option>
<option value="bird">bird</option>
</select>
If you select only one of the options the query works. If you select more than one option you get 0 results.
I need to do this at the query level and not loop over the results.
Any help would be greatly appreciated.
Thank you