MySQL Query with multiple AND statements seems to be ignoring one

后端 未结 5 1505
花落未央
花落未央 2020-12-20 00:25

I\'m trying to run a query on a MySQL database, but I found that it seems to be ignoring the \'status\' item.

SELECT * FROM  `posts`  
WHERE
      `tags` LIK         


        
5条回答
  •  一整个雨季
    2020-12-20 01:15

    have you tried something like:

    SELECT * FROM  `posts`  
    WHERE
         ( `tags` LIKE '%gda%' 
       OR `tags` LIKE '%contests%' 
       OR `tags` LIKE '%merch%')
      AND `newsID` != '2134' 
      AND `status` > '1' 
    ORDER BY  `postDate` DESC  LIMIT 5
    

提交回复
热议问题