Further to a request I sent a few minutes ago:

I have a query
<cfquery name="get_my_addresses_not" datasource="#request.main_dsn#" 
dbtype="ODBC">
SELECT  tblAddressesAT.AddressType
FROM    tblAddressesAT
WHERE   tblAddressesAT.AddressType NOT IN ('Shop', 'Postal')
</cfquery>

which gives me exactly what I want   (there are 3  address types in 
tblAddressesAT - the 3rd being Head Office) so
<cfoutput query="get_my_addresses_not">#AddressType#</cfoutput>
gives me Head Office

BUT
I want to dynamically set the NOT IN clause via a query
<cfquery name="get_my_addresses" datasource="#request.main_dsn#" dbtype="ODBC">
        SELECT  AddressType,PremisesID
        FROM    tblAddresses
        WHERE PremisesID=58

then I change this to a list

<CFSET my_addresses=QuotedValueList(get_my_addresses.AddressType)>
which gives me
'Postal','Shop'

But when I change the NOT IN clause to ('#my_addresses#')
I get too many single quotes and if I remove the single quotes from the 
clause I get a syntax error

Any clues please?

Seamus
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to