mySQL - Separate Lastname,Firstname and CompanyName entries from a single column
Posted
by
Decalmo
on Stack Overflow
See other posts from Stack Overflow
or by Decalmo
Published on 2012-12-17T22:50:21Z
Indexed on
2012/12/17
23:03 UTC
Read the original article
Hit count: 382
I've got a column in a database which contains company names, and customer names all in one field... what I'd like to do is keep the CompanyName column completely intact, but wherever there is a comma in the CompanyName I'd like to take that information and populate it into a FirstName and LastName field. So that basically...
Before:
CompanyName:
Big Company Inc
Smith, John
Sue, Maggie
After:
CompanyName:
Big Company Inc
Smith, John
Sue, Maggie
LastName:
Smith
Sue
FirstName:
John
Maggie
This one is pretty dang tricky for me... Any help is greatly appreciated!
© Stack Overflow or respective owner