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