Creating a list that SQL can search using IN
I have to create a list from a previous query and also append another value to the list.
To test I created the list manually, with some basic code
<CFSET country_list="">
<CFSET country_list = listappend(country_list,'''AU''')>
<CFSET country_list = listappend(country_list,'''99''')>
And then ran the query to search for records that contain either AU or 99
SELECT DISTINCT(campcountry_camp_uid)
FROM campaign_countries
WHERE campcountry_country_short IN ('#country_list#')
However, I'm having trouble with the SQL because it does not like the way I have created thelist, so a CFDUMP shows this
SELECT DISTINCT(campcountry_camp_uid) FROM campaign_countries WHERE campcountry_country_short IN ('''AU'',''99''')
This does not retrieve any records. I've tried all sorts of ways of creating the list and tweaking the SQL but can't seem to get it right.
Appreciate any pointers
Thanks
Mark
