zoukankan      html  css  js  c++  java
  • 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 '%替换关键词%';

  • 相关阅读:
    微信小程序入门实例
    textarea 的value值以及演示
    Think php (TP5) 批量删除全部源码
    Think php TP5 CURD 增删改查全部源码
    TP5 Think php 批量添加全部源码
    centos7 supervisor管理redis
    Centos7 设置redis开机自启
    Centos7安装gearman和php扩展
    nginx-403
    FFmpeg-截取视频图片
  • 原文地址:https://www.cnblogs.com/pangchunyu/p/13029830.html
Copyright © 2011-2022 走看看