系统WINDOWS 2003 在SQL2000中in 和 not in联用没任何问题,但到了2005中出现了查询异常缓慢的问题,
原先查询时2分钟,但现在查询时2个小时
SELECT u1.FSupplyID,sum(v1.FConsignAmount) from ICStockBill u1 inner join ICStockBillEntry v1
on u1.FInterID=v1.FInterID
where u1.fsupplyid in (select fitemid from #custid)
and u1.fbillno not in (select bno21 from #hooked where fdate<'2010-03-01')
group by u1.FSupplyID求高手帮忙
原先查询时2分钟,但现在查询时2个小时
SELECT u1.FSupplyID,sum(v1.FConsignAmount) from ICStockBill u1 inner join ICStockBillEntry v1
on u1.FInterID=v1.FInterID
where u1.fsupplyid in (select fitemid from #custid)
and u1.fbillno not in (select bno21 from #hooked where fdate<'2010-03-01')
group by u1.FSupplyID求高手帮忙
not in可以用不等式 代替
1.where u1.fsupplyid in (select fitemid from #custid)为不相关的子查询,不会过滤会先查询出来#custid中所有的fitemid,可以用join...on
或者exists
2.not in可以修改为not exists
3.2000和2005的server的配置是否一样呢.