Split value from one field to two

前端 未结 14 2526
面向向阳花
面向向阳花 2020-11-22 03:49

I\'ve got a table field membername which contains both the last name and the first name of users. Is it possible to split those into 2 fields memberfirst<

14条回答
  •  离开以前
    2020-11-22 04:09

    I had a column where the first and last name were both were in one column. The first and last name were separated by a comma. The code below worked. There is NO error checking/correction. Just a dumb split. Used phpMyAdmin to execute the SQL statement.

    UPDATE tblAuthorList SET AuthorFirst = SUBSTRING_INDEX(AuthorLast,',',-1) , AuthorLast = SUBSTRING_INDEX(AuthorLast,',',1);
    

    13.2.10 UPDATE Syntax

提交回复
热议问题