Re: Substring functions in mySQL

2004-09-08 Thread SGreen
I guess that would depend on what you consider a "last name" or a "middle name" A typical "western" name has 3 parts, like your example. However there are many names like "van der Plaats" or "de la Hoya" that are not so easy to detect based simply on what space to split the name at. What about

Re: Substring functions in mySQL

2004-09-08 Thread Wesley Furgiuele
Assuming there are no parts of a name that include more than one word (e.g., "Mary Jo" being someone's first name), an easy way would be to use SUBSTRING_INDEX. First Name = SUBSTRING_INDEX( namefield, ' ', 1 ); Middle Name = SUBSTRING_INDEX( SUBSTRING_INDEX( namefield, ' ', 2 ), ' ', -1 ); Last N

Substring functions in mySQL

2004-09-08 Thread wally . randall
How can I extract a middle segment of text in mySQL. For example a column contains this string: 'William Walker Jones'. I need to split this into the first, middle, and last names. I can easily extract the first and last names but how do I extract the Middle name?