mySQL - Separate Lastname,Firstname and CompanyName entries from a single column
- by Decalmo
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!