You're missing the single quotes :) You cfqueryparam and the list="true" variable <cfqueryparam cfsqltype="cf_sql_varchar" value="#foo.my_states#" list="true" />
On Tue, Mar 13, 2012 at 11:07 AM, Nick Sweeney <[email protected]> wrote: > > Hey eveyrone! > > This should be simple - but for some reason I can't get this to work. I need > to get a list of dealers from the database ased on he "Territory" they are > in. But they Query is breaking... ? > > Here is sort of what I am doing: > > <cfset variables.StateList = "IA,IL,IN,MI,MN,MO,OH,WI"> > > <cfquery name="qryGetZipCodes" datasource="#Application.DSN#" > username="#Application.username#" password="#Application.password#"> > SELECT id , dealer ,contact_person , contact_phone , address_1 , > address_2 , city , state , province, country , zip , phone , toll_free , fax > , website > FROM orig_dealers > Where orig_dealers.state IN (#variables.StateList#) > </cfquery> > > Which produces the Query > > SELECT id , dealer ,contact_person , contact_phone , address_1 , address_2 , > city , state , province, country , zip , phone , toll_free , fax , website > FROM orig_dealers Where orig_dealers.state IN (IA,IL,IN,MI,MN,MO,OH,WI) > > But it says I have an error in my Syntax...? > > What am I missing here? It works if I use IDs - but not state. Can't I use > "text" for IN queries...? > > Thanks in Advance! > > - Nick > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5818 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
