mysql多个字段模糊查询是否包含某个词

Posted 大雨大雨大雨

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql多个字段模糊查询是否包含某个词相关的知识,希望对你有一定的参考价值。

SELECT
*
FROM
my_db.my_article_data
WHERE
CAST(
my_db.my_article_data.content AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.template AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.relation AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.copyfrom AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.myfiles AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.redirecturl AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.telephone AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.address AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.fax AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.zipcode AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.email AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘
OR CAST(
my_db.my_article_data.email2 AS CHAR CHARACTER
SET utf8
) COLLATE utf8_general_ci LIKE ‘%替换关键词%‘;

以上是关于mysql多个字段模糊查询是否包含某个词的主要内容,如果未能解决你的问题,请参考以下文章

Mysql如何查询和字段中某个字或词相同的关键字?

求助asp两个字段中模糊查询

Mysql 精确查询是否字段中包含某个字符串

mysql怎么查询某个字段里的字符串?

mysql判断某个字符串是否包含某个字符串的3种方法

mysql正则查询 模糊查询