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<
It seems that existing responses are over complicated or not a strict answer to the particular question.
I think, the simple answer is the following query:
SELECT
SUBSTRING_INDEX(`membername`, ' ', 1) AS `memberfirst`,
SUBSTRING_INDEX(`membername`, ' ', -1) AS `memberlast`
;
I think it is not necessary to deal with more-than-two-word names in this particular situation. If you want to do it properly, splitting can be very hard or even impossible in some cases:
In a properly designed database, human names should be stored both in parts and in whole. This is not always possible, of course.