读书人

视高手解查

发布时间: 2013-03-04 17:22:12 作者: rapoo

望高手解查!
select acct02a.cust_id,acct02a.custname,acct15a.ar_tran,acct15a.tran_d,acct16b.ar_vouch,acct16b.vouch_d,acct16b.payamnt,acct15a.ttlamnt from acct02a,acct15a,acct16b where (acct15a.tran_d>=40909 and acct15a.tran_d<=40939) and (acct02a.cust_id=acct15a.cust_id) and (acct16b.ar_tran=acct15a.ar_tran) AND (acct02a.cust_id>='AH001' and acct02a.cust_id<='ZM203') order by acct02A.CUST_ID
例如以上句,在SQL 查器中行示0.02秒.但是利用DELPHI的ADOQUERY控制提取所有(果大概5000千),需要3分左右.在DELPH如果可以上面SQL查的果快速提取出? delphi
[解决办法]
将SQL改成下面的试试:
select acct02a.cust_id,acct02a.custname,acct15a.ar_tran,acct15a.tran_d,acct16b.ar_vouch,acct16b.vouch_d,acct16b.payamnt,acct15a.ttlamnt
from acct02a join acct15a on (acct02a.cust_id=acct15a.cust_id) and (acct02a.cust_id>='AH001' and acct02a.cust_id<='ZM203') and (acct15a.tran_d>=40909 and acct15a.tran_d<=40939)
join acct16b (acct16b.ar_tran=acct15a.ar_tran)
order by acct02A.CUST_ID

[解决办法]

select acct02a.cust_id,acct02a.custname,acct15a.ar_tran,acct15a.tran_d,acct16b.ar_vouch,acct16b.vouch_d,acct16b.payamnt,acct15a.ttlamnt from acct02a,acct15a,acct16b where (acct15a.tran_d>=40909 and acct15a.tran_d<=40939)  and (acct02a.cust_id=acct15a.cust_id) and (acct16b.ar_tran=acct15a.ar_tran) AND (acct02a.cust_id>='AH001' and acct02a.cust_id<='ZM203')   order by acct02A.CUST_ID 


弄好看点

读书人网 >.NET

热点推荐