SQL中的or 的用法

select top 10 * from calls_item_package where 1=1 and parentNo = 'UU1501467168003' and orderPlan = '1' and (datediff(HH ,limtDate,getdate())<=6 or limtDate is null) and status != 2 and itemid not in (select top 0 itemid from calls_item_package where 1=1 and parentNo = 'UU1501467168003' and orderPlan = 1 and (datediff(HH ,limtDate,getdate())<=6 or limtDate is null) and status != 2 order by dataPriority desc,level desc ) order by dataPriority desc,level desc

有 or 的时候必须使用括号括起来,不然就会出错啦

原文地址:https://www.cnblogs.com/itchenfirst/p/7305975.html