As state abbr. are always 2 chars, this is reliable. If you have list
items of variable length you can do

',' + States + ',' LIKE '%,#FORM.stateabbr#,%'

I don't see a better way of doing it if you can't change the database.

> -----Original Message-----
> From: Tony Gruen [mailto:[EMAIL PROTECTED]
> Sent: dinsdag 10 februari 2004 8:04
> To: CF-Talk
> Subject: SQL Pickle
>
> I have done this in reverse with the Membership Test (IN) and
> I have figured out a way for it to work (example below) but
> this does not seem the best way. Can I ask for some SQL input?
>  
> I have one field in a database (SQL Server 2000) that
> contains a comma separated list of state abbr. (AL,CA,TX). I
> am submitting ONE state selection (CA) for example to a
> query. I simply need to go to the database and select records
> CONTAINING 'CA' within the comma delimited list..
>  
> Here is what I have (abbreviated for simplicity) -  the
> database field with the comma delimited list is named states.
> The variable FORM.stateabbr is sent in via a form.
>  
> SELECT *
> FROM  Members
> WHERE States LIKE '%#FORM.stateabbr#%'
>  
> Please share your input. I am not the greatest GURU at SQL
> but I am thinking that there is a more eloquent (and
> reliable) way of doing this particular search.
>  
> Tony
>  
>  
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to