Skip to content
Advertisement

SQL Match individual word?

I am using like statement: %word% but the problem is it also matches words that are inside other words.

How can I match words that are separate from the rest in the string like this. I wanna match word1 in these strings:

word1 word2 word3

word2 word1 word3

word2 word3 word1

And don’t match this: word2word1

Advertisement

Answer

The main idea is: match the space too.

col LIKE '% doc %' OR col LIKE '% doc' OR col LIKE 'doc %' OR col = 'doc'
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement