SQL奇怪问题,某段数据Select比别的数据段速度慢!!
SQL奇怪问题,某段数据Select比别的数据段速度慢!!
有相关表和字段
表A S_NO
表B S_NO、P_NO
表C P_NO、P_Date
里面有1~11月的相关数据
使用
select * from A表 where S_NO in(select S_NO from B表 where P_NO in (select P_NO from C表 where P_date between '2006-01-01' and '2006-11-30'))
这一个SQL语句得到结果的时间要比
select * from A表 where S_NO in(select S_NO from B表 where P_NO in (select P_NO from C表 where P_date between '2006-11-01' and '2006-11-30'))
这句得到结果的时间短得多.
不明白怎么回事
请各位指教一下.