简体   繁体   中英

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 ?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM