sql-逻辑运算符-优先级

and的优先级高于or

select  *  from  table  where  Condition1 and  Condition2 or Condition3  

等价于

select   *   from   table   where   (Condition1   and   Condition2)   or   Condition3  

想要的效果

select   *   from   table   where   Condition1   and   (Condition2   or   Condition3)  

参考站点:

http://blog.csdn.net/eclothy/article/details/48265445

你可能感兴趣的:(sql)