I've got a column in a mysql table which contains name information:
"Fred Barney Feuerstein", for example.
Now I need to split this string to create a view with two columns - firstname, lastname. I know how to select the lastname:
select (SUBSTRING_INDEX(name, ' ', -1)) as lastname from contacts;
But I don't know how to extract all the other information to one new field.
What I'm searching for is something like the SUBSTRING_INDEX
for everything except the last field.