MySQL: How to separate a name field in one table into firstname / lastname in two separate tables?
- by Eileen
I have a drupal database where the node table is full of profiles. The field node.title is "Firstname Lastname". I want to separate the names so that node.title = "Firstname", and over in another table entirely, content_type_profile.field_lastname_value = "Lastname". The entries in the two tables can be joined on the field nid.
I'd love to run a SQL command to do this, and I am fine with taking the naive approach that the first word is the first name, and everything else in the field is last name -- it will mean a few manual corrections down the line, but that's much better than doing it all by hand in the first place.
(I read this question and surely the answer lies in there but I am not that SQL-savvy and am not sure how to make it work for my database.)
Thanks!