2
I need to get the penultimate name from inside a string.
For example;
Antonio Alves Ferreira Castro
need the Ferreira
I know to catch the Castro I can use the
SUBSTRING_INDEX(NOME, ' ', -1)
tried the -2, but it does not work.
2
I need to get the penultimate name from inside a string.
For example;
Antonio Alves Ferreira Castro
need the Ferreira
I know to catch the Castro I can use the
SUBSTRING_INDEX(NOME, ' ', -1)
tried the -2, but it does not work.
2
Thus:
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('Antonio Alves Ferreira Castro', ' ', -2) , ' ', 1) penultimo_nome
Hugs.
Browser other questions tagged mysql
You are not signed in. Login or sign up in order to post.