문제

Is there a way to search by beginning of any substring in the record?

Concrete example would be:

Nike shoes, Shoes Nike, Sunick shoes

Suppose search string is 'ni'.

If I would use wild character on the end of the search string only I would get only first record. If I use wild char on both end I would get all three records.

Is there a way to get only first two?

Maybe to do search by to strings with wild char on the end, where second parameter would be identical to first but with prepended space.

Something like "WHERE field LIKE 'ni%' OR '% ni%'"

도움이 되었습니까?

해결책

You can use a regular expression to match only strings that begin at a word boundary:

WHERE field REGEXP '[[:<:]]ni'
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top