Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Here is a collective farm, but universal solution.
For a more beautiful one, you need to know what kind of server you have (MSSQL, MySQL, etc.)
SELECT *
FROM table
WHERE text LIKE '%555%'
AND NOT (
text LIKE '%5550%'
OR text LIKE '%5551%'
OR text LIKE '%5552%'
OR text LIKE '%5553%'
OR text LIKE '%5554%'
OR text LIKE '%5555%'
OR text LIKE '%5557%'
OR text LIKE '%5557%'
OR text LIKE '%5558%'
OR text LIKE '%5559%'
)
Assuming MS SQL, you can use the option "any character, but not five":
like %555[^5]%
, although in a pure version it is worth beating at the beginning and end of the string - that is, there will be no character before / after and "555z" or "abcde555" - will not be caught.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question