为什么select * from produit where title like '%想向%'' and id_ku= '5' 

select * from produit where id_ku= '5' and  title like '%想向%'
的结果会完全不一样

解决方案 »

  1.   

    title like '%想向%'' '%想向%'多了个'呢
      

  2.   

    不好意思,语句是多了一个’,但是我找了一下资料,是关于SQL运算符的优先级的问题,应该把select * from produit where (title like '%想向%') and id_ku= '5'  
    就和这个
    select * from produit where id_ku= '5' and title like '%想向%'
    结果一样 ,有兴趣大家可以试试。
      

  3.   

    用and 连接,表达式在前与在后结果应是相同的,但性能上是否有差别需印证,= 比like 性能要好.