If you must do it this way then ensure that you always put a comma at the
beginning and at the end of the list of numbers before inserting into the
DB. That you end up with this: ,4,15,26,44,101,9, . Then use LIKE %,4,% to
get your results.
I'd like to say that there are better ways of doing this...
[table] users ----(FK)----> [table] users_roles <----(FK)---- [table] roles
+-----------------------------------------------+
Bryan Love
Macromedia Certified Professional
Internet Application Developer
Database Analyst
Telecommunication Systems
[EMAIL PROTECTED]
+-----------------------------------------------+
"...'If there must be trouble, let it be in my day, that my child may have
peace'..."
- Thomas Paine, The American Crisis
-----Original Message-----
From: chad [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 3:52 PM
To: CF-Talk
Subject: Re: Query Issue
Why do it in the query? Grab your list and loop over it until you find a
true.
You should probably make another table and related that field out instead
of making a comma delimited list in the db... but maybe you don't have
control over the db.
At 03:42 PM 5/20/2002 -0700, you wrote:
>Howdy List!
>
>Can someone please 'gimmie a thread' on this? (ie: Brain thread, as in cpu
>thread)
>
>I have an existing database with a field named 'AccessList'. This field is
a
>comma delimited list of IDs (numeric only). These IDs are for users who are
>to be granted access to a function. For example one entry would be
>4,15,26,44,101,9.
>
>I am trying to devise a query that will check the field for a single
userID.
>Say 4 for example... note that 44 also exists in the list.
>
>My fumbling attempts to devise a way using LIKE and IN are not working.
>
>
>
>
>
>
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
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