concat与mysql

2ul0zpep  于 2021-06-20  发布在  Mysql
关注(0)|答案(2)|浏览(388)

我想在表中的多个字段中搜索 catalog_form . 使用concat和likes(我使用 foreach 到循环)
我错过了什么?谢谢你的帮助。

SELECT * 
FROM catalog_form 
WHERE CONCAT(image, acc_no, cat_no, art_type, title, mat_tech
            , acquired_by, dimensions, maker_pub, place_origin
             , location, description, encoded_by) LIKE '%maria%' 
             OR LIKE '%great%' 
ORDER BY id DESC LIMIT 0, 10
ncgqoxb0

ncgqoxb01#

应该为or子句重复concat值

SELECT * 
FROM catalog_form 
WHERE CONCAT(image, acc_no, cat_no, art_type, title, mat_tech
            , acquired_by, dimensions, maker_pub, place_origin
             , location, description, encoded_by) LIKE '%maria%' 
OR 
      CONCAT(image, acc_no, cat_no, art_type, title, mat_tech
            , acquired_by, dimensions, maker_pub, place_origin
             , location, description, encoded_by) 
             LIKE '%great%' 
ORDER BY id DESC LIMIT 0, 10
mjqavswn

mjqavswn2#

我能解决这个问题,我只是把整个concat放在第二个之前。谢谢你的时间!!!

相关问题