首頁  >  問答  >  主體

mysql查询id,IN根据结果模糊问题

select id,title,content from myarticle where id IN(219,220,222,225) and content like '明明' or title like '明明';

用 where id IN(219,220,222,225),给我返回别的 267的文章
怎么让后面的like 根据 IN的结果做模糊?谢谢了

阿神阿神2743 天前719

全部回覆(2)我來回復

  • 黄舟

    黄舟2017-04-17 13:49:58

    雷雷

    回覆
    0
  • 阿神

    阿神2017-04-17 13:49:58

    and的優先權比or高,所以A and B or C實際上是(A and B) or C,你要用括號來改變優先權A and (B or C)才行。

    回覆
    0
  • 取消回覆