I need to make a query that returns only one result, it is the following: among my records I have a field called name and I want the query to return the name that contains cumla with the following:
-
If I say "hello" and in the registers I have: "cat" "hello" and "dog" I must return "hello", however I want to limit it to only having up to 2 different characters, that is if I have "holassssss" or "aaaaahola" would not apply, but if I have "holass" or "aahola" then yes
-
If there is more than one result then return the one with fewer different characters, that is, if the records that match are "holass", "hello" and "hello" then you should return "hello"
-
Ignore if it is uppercase or lowercase
I tried using:
SELECT NOMBRE FROM USUARIO WHERE NOMBRE LIKE '%__hola__%';
But as you will notice it does not achieve what was expected, I hope you can help me.