質問

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