Stephen,

instead of using '#replace(attributes.PostCode,",","','",'All')#')

try using:

ListQualify(list, qualifier [, delimiters ] [, elements ])

as 

AND postcode IN (#listqualify(attributes.postcode, "'")#)

This will create:

AND postcode IN ('BH2','NN1','MK10' etc etc etc)

-------------------------------------------------------
Rich Wild
Senior Web Developer

-------------------------------------------------------
e-mango                      Tel: 01202 755 300
Gild House                           Fax: 01202 755 301
74 Norwich Avenue West
Bournemouth                   Mailto:[EMAIL PROTECTED]
BH2 6AW, UK                      http://www.e-mango.com
-------------------------------------------------------
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of e-mango.com ltd,
unless otherwise explicitly and independently indicated
by an authorised representative of e-mango.com ltd.
-------------------------------------------------------




> -----Original Message-----
> From: Stephen Adams [mailto:[EMAIL PROTECTED]]
> Sent: 05 March 2002 11:06
> To: CF-Talk
> Subject: Slight OT: SQl problem
> 
> 
> Hi,
> 
> I am trying to run a query that checks through a list of 
> postcodes, this list comes in a comma separated list (eg N12, 
> N13, N15 (these are english postcodes)).  The problem is that 
> I want to use a LIKE in my AND clause that checks the 
> postcode.  So my query looks like this:
> 
> select        PropertyID
>       PropertyAddress,
>       Town
> from  Properties
> where Town = '#attributes.Town#'
> AND   Postcode IN ('#replace(attributes.PostCode,",","','",'All')#')
> 
> But this leads to some properties being missed out, so I 
> would ideally like to use LIKE in my AND clause so it reads:
> 
> AND   Postcode LIKE '#attributes.Postcode#%'  
> 
> The problem here is how do I deal with the comma separated 
> list of Postcodes.
> 
> Any ideas anyone ?
> 
> Stephen
> 

______________________________________________________________________
Get Your Own Dedicated Windows 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=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to