Mysql, PHP, searching for multiple words

前端 未结 5 1108
有刺的猬
有刺的猬 2021-01-23 05:11

I\'m trying to search a table for specific words.

Say I have a list of words: printer,network,wireless,urgent

I only want to return those rows where all of these

5条回答
  •  梦谈多话
    2021-01-23 05:46

    not the best way, but:

    SELECT * FROM tickets WHERE
    concat(subject,body) REGEXP "printer" AND
    concat(subject,body) REGEXP "network" AND
    concat(subject,body) REGEXP "wireless" AND
    concat(subject,body) REGEXP "urgent"
    

提交回复
热议问题