Do you mean this:
<CFSET FieldList = "field1,field2,field3,field4">  <!--- you could get this 
dynamically if you want --->
<CFSET ValueToSearch = "hello" >
<cfquery name="Lookup" datsource="yourdatasource">
        SELECT #fieldlist#
        FROM yourtable
        WHERE
                <CFLOOP LIST="#fieldlist#" INDEX="field">
                        #field# = <cfqueryparam cfsqltype="SQL_VARCHAR" 
value="#ValueToSearc#"> OR
                </CFLOOP>
                1 = 0
</cfquery>
        
I'm sure there are more than one way to do it, but that's how I'd do it.  The 1 
= 0 is needed because you have to have another comparison after the last OR in 
the list.  If you are checking against other values as well, then you could 
just use those instead.  Basically, in this example, it's just 'filler'.

Dave

-----Original Message-----
From: Merrill, Jason [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 26, 2005 12:06 PM
To: CF-Talk
Subject: Simple query question


How do I implement a simple query to search all the field values of a
table for a value - basically, I need to check to see if the user name
the person entered already exists in the database.  Something like a
SELECT WHERE and then a <cfif value exists from the query return?  

Thanks.

Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com




NOTICE:
This message is for the designated recipient only and may contain privileged or 
confidential information. If you have received it in error, please notify the 
sender immediately and delete the original. Any other use of this e-mail by you 
is prohibited.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212840
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to