Hi, you could try:

SELECT name,
       SUBSTRING_INDEX(name,' ', 1) as first, 
       SUBSTRING_INDEX(v2, ' ', -1) as last 
FROM table

For the uppercase of the first letter, as i don't know a specific
functions to do that in MySQL (it has ucase and lcase but for all the
word), you must "play" with other functions in MySQL. See:
http://www.mysql.com/doc/en/String_functions.html

On Sat, 2003-02-08 at 23:33, Mike Blezien wrote:
> Hi all,
> 
> I think this can be done with a SQL query, but not have much luck getting it 
> right. Was hoping to get some suggestions on the best way to do this.
> 
> I need to extract the 'name' column in a mysql database table. split the name so 
> we have a "first" and "last" name value, as the name was original entered into 
> the database as their full name instead of the first and last name. My question 
> is, using SQL, can I split the 'name' column to get the two value, then do an 
> UPPER case on the first character for the first name created from the split of 
> the 'name' columnm value.
> 
> I can do this using the Perl programming I am writing, but was pretty sure I do 
> this within the SQL query, but haven't been able to get it to work properly.
> 
> thanks for any help,
> 
> 
> -- 
> Mike<mickalo>Blezien
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Thunder Rain Internet Publishing
> Providing Internet Solutions that work!
> http://www.thunder-rain.com
> Tel:  1(985)902-8484
> MSN: [EMAIL PROTECTED]
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-- 
Diana Soares


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to