0
Precise research by the letter initial of the surnames within a column that has full and compound names.
Examples:
Jean Carlos
Luciana Menezes Rezende
Roberto Menezes Souza
Vero Vinicius
Desired result when searching for last names with the letter M:
Menezes Rezende
Menezes Souza
The closest I could get was:
Select
serv.nome as Nome,
substring (serv.nome from position
(' ' in serv.nome) for character_length(serv.nome)) as Sobrenome
from fol_servidor serv
where serv.nome like '%' || :NOME;
It should not be: Where Last name like '%' || :FIRST NAME; ?
– anonimo
I am using ibexpert for handling and when I put " Where Last Name like '%' || :FIRST NAME; " error of Column Unknown. LAST NAME. At line 7, column 17.
– Walisson
I don’t work with Firebird but you can always do: Where substring(Serv.nome from position (' in Serv.nome) for character_length(Serv.nome)) like '%' || :NOME; or take only the first character of the surname and test if it equals :NOME.
– anonimo
I tried that way but it does not return the desired results as I quoted from example in the question
– Walisson
In the question the example is different from my suggestion.
– anonimo
I refer to the results I quoted... The way I said does not return the desired results
– Walisson
There really is an error the correct is: like :NAME || '%';.
– anonimo