Nikul Panchal
Nikul Panchal

Reputation: 85

how to check string with column which have specific word in mysql

I have table invalidtext. In this table I have records like

+----+---------+
| id |  text   |
+----+---------+
|  1 | Yahoo   |
|  2 | Gmail   |
|  3 | Windows |
+----+---------+

Now I have a string like

hello yahoo how are you?

I want to check if "hello yahoo how are you?" contains any word which is in invalidtext table.

We can see yahoo word is in this table, so record should have to be find.

Which query will work to search ?

Upvotes: 0

Views: 237

Answers (1)

juergen d
juergen d

Reputation: 204756

select text
from invalidtext
where '$input' like concat('%', text, '%')

Upvotes: 1

Related Questions