mysql查询id,IN根据结果模糊问题
阿神
阿神 2017-04-17 13:47:58
0
2
755

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的结果做模糊?谢谢了

阿神
阿神

闭关修行中......

reply all(2)
黄舟
select id,title,content from myarticle where id IN(219,220,222,225) 
and 
(content like '明明' or title like '明明');
阿神

and has a higher priority than or, so A and B or C is actually (A and B) or C. You have to use brackets to change the priority A and (B or C).

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template