I need to query a table producto
where there is a property called nombre
to search for a similar name LIKE
.
SELECT *
FROM producto
WHERE nombre LIKE '%Dulces%'
But now I need this to make the use of the S
and of indifferent Z
, that is, if they search Dulcez
for the results of the word to appear Dulces
and also the results of Dulcez
. Likewise, if they search for the word Dulces
, the results of Dulces
and should appear Dulcez
.
For the same problem, I have to ignore the use of the leta H
, that is, if they search, Aora
the results of Ahora
.
what you are trying to do is possible using soundex, look for what you indicate in the following way:
The best way to do it is to leave both, the search string and the fields of the table in a single format, in this case transform all the 's' into 'z' and eliminate all the 'h' from both, for this it is you can use
replace()
as follows:I hope you find it useful, greetings.