当前位置:
代码迷
>>
Sql Server
>> 请问像这种SQL的条件如何优化好!
详细解决方案
请问像这种SQL的条件如何优化好!
热度:
82
发布时间:
2016-04-24 20:32:24.0
请教像这种SQL的条件怎么优化好!?
TAB( A varchar(100),Bvarchar(100),..)
...
where ([A]+[B]) NOT IN (SELECT ([A]+[B]) FROM TAB)
分享到:
------解决方案--------------------
方法1:
from tab a
where not exists (select 1 from tab b where a.a=b.a and a.b=b.b)
方法2:加一个计算列,存放A+B的值,然后对这个计算列加上索引,当一个新的列
相关解决方案