需要考虑的语句

declare @emp_Code as nvarchar(10)
set @emp_Code='00131'
select s.*,a.audit_Date as lastaudittime,enmName=(select empName from emp where empCode=s.emp_Code),0 as isEnbled from (select id from audit_main where emp_code=@emp_Code or type in(186,209,231)  union select main_id as id from audit_Sub where audit_empCode=@emp_Code union select main_id as id from audit_Sub_Emp where audit_Emp_Code=@emp_Code
  as t inner join audit_Main as s  on t.ID = s.ID inner join audit_sub as a on   s.lab_complete =1 and s.type in(1,4,0,3,10,11,12,13,14,5,6,2,7,51,52,150,152,200,168,151,153,157,162,159,160,161,158,163,164,165,166,167,156,154,155,169,171,170,173,172,174,175,176,177,178,15,180,181,182,183,184,185,186,187,188,189,191,192,190,193,194,195,196,197,198,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240) and a.ID =s.cur_Sub_id
   and (a.isPass in(1,3,4))  使用这句需要1秒
    --and (a.isPass <>2) 使用这句需要2秒
 and  isnull(s.isDisannuled,0)=0

 

难道in和<>有这么大的差别?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值