splitting entries in a mysql database
a client has a typo3 installation running that includes front end login. the data are stored in a table fe_users on the mysql database. all the names were entered in one field (name) in the form first_name last_name. for sorting by last name - as needed for a phone list - this is useless. now re-typing all 369 names manually doesn't make any sense either - it would be too tedious and error prone.
a single line of sql does the trick:
UPDATE fe_users SET first_name=SUBSTRING_INDEX(name,' ',1),last_name=SUBSTRING_INDEX(name,' ',-1) WHERE (LOCATE(' ',name)>0);
(it really has to be one line without line break.)




