I think you can use something like this in Microsoft SQL Server although
I haven't tried it:

SELECT myfield
FROM myQuery
Where State in ('#myState#')

Nathan Chen


-----Original Message-----
From: Torrent Girl [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 16, 2006 11:14 AM
To: CF-Newbie
Subject: using Lists in Query 

Hello All

I have a list of states that I want to use in the where clause of a
query.

Here is my code but it is not working

<cfset myStates = "AZ, CA, CO, FL, ID, NM, NV, OR, UT, WA">

<cfquery dbtype="query" name="getData">
        SELECT myfield
        FROM myQuery
        WHERE State = '<cfloop index="i" list="#myStates
#"><cfoutput>#i#</cfoutput></cfloop>'
</cfquery>


Any help would be appreciated.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1708
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to