Split mysql string using SUBSTRING_INDEX() function

http://www.w3resource.com/mysql/string-functions/mysql-substring_index-function.php

eg. of split and update a string in same table:

update employee set Fname = SUBSTRING_INDEX(EmployeeName, ' ', 1),
Lname = SUBSTRING_INDEX(SUBSTRING_INDEX(EmployeeName,' ', 2), ' ',-1)

Advertisements