List:General Discussion« Previous MessageNext Message »
From:Wesley Furgiuele Date:September 8 2004 2:53pm
Subject:Re: Substring functions in mySQL
View as plain text  
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

First Name = SUBSTRING_INDEX( namefield, ' ', 1 );
Middle Name = SUBSTRING_INDEX( SUBSTRING_INDEX( namefield, ' ', 2 ), ' ', -1 );
Last Name = SUBSTRING_INDEX ( namefield, ' ', -1 );


On Wed, 08 Sep 2004 13:35:07 +0000, wally.randall@stripped
<wally.randall@stripped> wrote:
> 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?
Substring functions in mySQLwally.randall8 Sep
  • Re: Substring functions in mySQLWesley Furgiuele8 Sep
  • Re: Substring functions in mySQLSGreen8 Sep