Search a whole table in mySQL for a string

后端 未结 8 1615
孤城傲影
孤城傲影 2020-12-14 01:13

I\'m trying to search a whole table in mySQL for a string.

I want to search all fields and all entrees of a table, returning each full entry that contains the speci

8条回答
  •  抹茶落季
    2020-12-14 01:44

    Try this code,

    SELECT 
           * 
    FROM 
           `customers` 
    WHERE 
           (
              CONVERT 
                   (`customer_code` USING utf8mb4) LIKE '%Mary%' 
              OR 
              CONVERT(`customer_name` USING utf8mb4) LIKE '%Mary%' 
              OR 
              CONVERT(`email_id` USING utf8mb4) LIKE '%Mary%' 
              OR 
              CONVERT(`address1` USING utf8mb4) LIKE '%Mary%' 
              OR
              CONVERT(`report_sorting` USING utf8mb4) LIKE '%Mary%'
           )
    

    This is help to solve your problem mysql version 5.7.21

提交回复
热议问题