On Tue, 14 Sep 2004 05:37:30 +0000, Curt Zirzow <[EMAIL PROTECTED]> wrote: > * Thus wrote Sagar C Nannapaneni: > > > > Hi everybody, > > > > I'm having a database named "items", inthat > > one field name is "itemname" and the contents of > > that field is as follows.... > > > > Monitor 15" - LG > > Monitor 17" - Samsung > > Keyboard - TVS > > Monitor 15" - Samsung > > Mouse - Genius > > Keyboard - Microsoft > > .... > > .... > > The first part is the component name and the second is the Company name > > I need to have the distinct components in this field...like this > > > > Monitor > > Keyboard > > Mouse > > > > Any help would b greatly appreciated.... > > In order to do that properly, you would need a normalized database, > a properly flattened data structure or hacked with some string > manipulation. Seek more help from a SQL or mysql list. > > Curt > -- > The above comments may offend you. flame at will. >
Little handson: there is a way of selecting a certian part of a field, for instance everything till the first occurance of a space or dash. Probably two ways even, one with regexes the other one with substr kinda calls - all directly requestable to mysql. though I'd follow Curt's advice if i were you, take two columns, or even three - components, specifications, brand .. or smth. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php