Proper Query syntax using a comma delimited list
Posted on 2008-10-13
I doing a cfquery against a table with a field call "gla". I want to use a listing (session.qmlist) generated from a prior input screen to compare against the table field "gla". If I get a hit from the table against the listing, I want to output the results.
I tried using Valuelist, and a cfloop to go to the 1-to-many elements in the input listing, and I am not getting a full listing back.
<cfset session.qmlist = #form.qmlist#>
<!--- <cfloop From = "1" To = "#ListLen(session.qmlist)#" index = "Counter"> --->
<cfquery name="qMAgla" datasource="#REQUEST.DSN.Source#">
select distinct upper(substring(gla,1,4)) gla
where upper(substring(gla,1,4)) IN ('#session.qmlist#')
and date_clsd = '01/01/1900'