OK I see.
Well in that case, the logic I outlined below works the same and should be applied to
your situation rather than using a VARCHAR field.
Among other problems you will encounter, one of the most common is that you won't be
able to easily search for a specific number in the list.
For example, if your datafield consists of the following numbers:
21,210,2100
You're going to have a hard time evaluating the list to look for "21".
As another listee pointed out, this is a process of "normalizing" the database. Take
advantage of SQL for its power. It's easier than dealing with text string
conversions.
Also, you become more employable when you build your databases correctly.
---mark
--------------------------------------------------------------
Mark Warrick
Phone: (714) 547-5386
Efax.com Fax: (801) 730-7289
Personal Email: [EMAIL PROTECTED]
Personal URL: http://www.warrick.net
Business Email: [EMAIL PROTECTED]
Business URL: http://www.fusioneers.com
ICQ: 346566
--------------------------------------------------------------
> -----Original Message-----
> From: Joel Firestone [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 27, 2000 8:03 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Selecting one number from a list
>
>
> I was storing them as a list so one item could be associated with several
> categories, instead of having to add one for each category. All I want is
> for an ID to be passed, and if that ID exists within that column, then
> display it.
>
> I'm trying all of these solutions. Thanks.
>
> Joel
>
> "Mark Warrick" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Why are you storing a list of numbers in a varchar field?
>
> If you were trying to associate attribtures of a product with
> attributes in
> other tables, then you should be using index tables.
>
> For example:
>
> PRODUCTS
> id_product product_name
> 1 t-shirt
> 2 baseball hat
> 3 sweater
>
> COLORS
> id_color color_name
> 1 white
> 2 black
> 3 red
>
> PRODUCTS_TO_COLORS
> id_product id_color
> 1 1
> 1 2
> 2 3
> 3 2
>
> Creating this index table would be basically the thing as having
> a products
> table with a varchar field for colors as I suspect you have it setup:
>
> PRODUCTS
> id_product product_name product_colors
> 1 t-shirt 1,2
> 2 baseball hat 3
> 3 sweater 2
>
> So why, you might ask, do you use another table to create the
> relationships?
> Well, becuase it's proper datbase design. You keep the numbers
> numbers and in
> doing so maintain the query and processing speed. Whenver you convert a
> datatype to or from text, you're going to cause headaches for yourself.
>
> ---mark
>
> --------------------------------------------------------------
> Mark Warrick
> Phone: (714) 547-5386
> Efax.com Fax: (801) 730-7289
> Personal Email: [EMAIL PROTECTED]
> Personal URL: http://www.warrick.net
> Business Email: [EMAIL PROTECTED]
> Business URL: http://www.fusioneers.com
> ICQ: 346566
> --------------------------------------------------------------
>
>
> > -----Original Message-----
> > From: Joel Firestone [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, June 27, 2000 6:04 AM
> > To: [EMAIL PROTECTED]
> > Subject: Selecting one number from a list
> >
> >
> > Everyone:
> >
> > I'm having a complete brain fart, so hopefully you guys can help.
> >
> > I have a table with a varchar field named catid. When a url
> variable named
> > catid is passed, the page grabs all the data for that specific
> > catid. Simple
> > stuff.
> >
> > My problem lies in now I need for the catid to be a list
> > (2,5,56,89). Thus the
> > varchar field, and not a numeric. How can I select those items
> > that contain
> > the correct url.catid? I tried the IN keyword, with no success.
> >
> > Any help would be greatly appreciated.
> >
> > Joel
> >
> >
> > ------------------------------------------------------------------
> > ------------
> > Archives: http://www.eGroups.com/list/cf-talk
> > To Unsubscribe visit
> > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf
> > _talk or send a message to [EMAIL PROTECTED] with
> > 'unsubscribe' in the body.
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=sts&body=sts/cf_tal
k or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebarRsts&bodyRsts/cf_talk or send a message
to [EMAIL PROTECTED] with 'unsubscribe' in the body.