码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2020-06-02 11:39:49      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:copy   from   content   files   dir   utf8   模糊查询   add   cte   

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多个字段模糊查询是否包含某个词

标签:copy   from   content   files   dir   utf8   模糊查询   add   cte   

原文地址:https://www.cnblogs.com/pangchunyu/p/13029830.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!