Skip to main content
Inspiring
Aug 12, 2008 3:10 PM UTC
Question

Newbie question: Search query

I'm really new to ColdFusion, so I hope this isn't a stupid question. I've been searching for the answer all over, and know it is something that most developers use, but I just can't find it. I'm able to create a search using one word, but how do I create a search with multiple words?
This topic is closed to new replies. Start a new post to keep the conversation going.

2 replies

Inspiring
Aug 12, 2008 4:02 PM UTC
You could try:

Select stuff
From table
WHERE field1 = "yes" or field1 = "no" or...

or maybe ues an existing list with something like this:
WHERE field1 IN (<cfqueryparam cfsqltype="cf_sql_varchar" list="yes" value="#my_list#">)
Translate
Inspiring
Aug 12, 2008 3:20 PM UTC
words = word1,word2,etc

select stuff
from tables
where

<cfloop list="#words#" index="ThisWord">
somefield like
<cfqueryparam cfsqltype="cf_sql_varchar" value="%#ThisWord#%">
or
</cfloop>
1 = 2
Translate