letsforum letsforum - 1 year ago 117
SQL Question

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

Answer Source

The main idea is: match the space too.

col LIKE '% doc %' OR col LIKE '% doc' OR col LIKE 'doc %' OR col = 'doc'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download