R
reedblue
Unregistered / Unconfirmed
GUEST, unregistred user!
我有一个语句:<br>SELECT A.*, B.accName, C.cdbCycleMoney<br>FROM arCeditBill A INNER JOIN<br> vwAccount B ON A.accID = B.accID INNER JOIN<br> arCeditBillCycleDetail C ON A.cdbID = C.cdbID AND C.arcID = 6<br>WHERE (A.accID IN<br> (SELECT X.cltID<br> FROM pdClientRelate X<br> WHERE X.slmID = 3300))<br>执行起来很慢,有时还会超时(数据多了);<br><br>但是如果用如下分步,得到的结果一样,前后全部执行却是飞快:<br>SELECT A.*, B.accName, C.cdbCycleMoney<br>INTO ##TmpDB<br>FROM arCeditBill A INNER JOIN<br> vwAccount B ON A.accID = B.accID INNER JOIN<br> arCeditBillCycleDetail C ON A.cdbID = C.cdbID AND C.arcID = 6<br>GO<br>SELECT * FROM ##TmpDB<br>WHERE (accID IN<br> (SELECT X.cltID<br> FROM pdClientRelate X<br> WHERE X.slmID = 3300))<br>GO<br>望高手指点分析一下