把or分开,因为用or时就没有用到索引!!! declare @count1 int declare @count2 intselect @count1=count(id) from historydata where HDChnBoBy like '%针刺毡%'select @count2=count(id) from historydata where HDChnsubject like '%针刺毡%' select @count1+@count2
把or分开,因为用or时就没有用到索引!!! declare @count1 int declare @count2 intselect @count1=count(id) from historydata where HDChnBoBy like '%针刺毡%'select @count2=count(id) from historydata where HDChnsubject like '%针刺毡%' select @count1+@count2
把or分开,因为用or时就没有用到索引!!!
declare @count1 int
declare @count2 intselect @count1=count(id) from historydata where HDChnBoBy like '%针刺毡%'select @count2=count(id) from historydata where HDChnsubject like '%针刺毡%'
select @count1+@count2
这个速度还慢了两秒,而且结果也不对.