C
cfjjj
Unregistered / Unconfirmed
GUEST, unregistred user!
有一个数据库文件loan.dbf,我想进行多重条件的联接查询,SQL语句如下:
SELECT DISTINCT A.* FROM loan A,loan B WHERE A.borrowerco=B.borrowerco AND A.loandate=B.realmature AND A.loansum>=B.loansum
结果程序报错,后来将之改为
SELECT DISTINCT A.* FROM loan A,loan B WHERE A.borrowerco LIKE B.borrowerco AND A.loandate LIKE B.realmature AND A.loansum>=B.loansum
程序能够运行,但查7000条记录,在PIII700的机器上竟用了12分钟。
后来发现borrowerco、loandate、realmature字段为C型,loansum为N型;
若将loansum改为C型,再用第一条语句来运行,3秒钟就搞定了。
现在我既不想改变原数据库结构,又想快速完成此查询,该怎么改SQL语句?
请高手不吝赐教,我将献上100分!
SELECT DISTINCT A.* FROM loan A,loan B WHERE A.borrowerco=B.borrowerco AND A.loandate=B.realmature AND A.loansum>=B.loansum
结果程序报错,后来将之改为
SELECT DISTINCT A.* FROM loan A,loan B WHERE A.borrowerco LIKE B.borrowerco AND A.loandate LIKE B.realmature AND A.loansum>=B.loansum
程序能够运行,但查7000条记录,在PIII700的机器上竟用了12分钟。
后来发现borrowerco、loandate、realmature字段为C型,loansum为N型;
若将loansum改为C型,再用第一条语句来运行,3秒钟就搞定了。
现在我既不想改变原数据库结构,又想快速完成此查询,该怎么改SQL语句?
请高手不吝赐教,我将献上100分!