你是用那个foxpro版本?用seek 会比用locate 更好更快
e.g.
if seek(...)
seek ...
endif活用索引吧, 不然你每次locate後, 都要go top, 重头再scan全表了.
e.g.
if seek(...)
seek ...
endif活用索引吧, 不然你每次locate後, 都要go top, 重头再scan全表了.
解决方案 »
- win7专业版安装SQL2005后,在使用中出现如下图的错误
- SQl表中数据计算更新问题
- 求一条SQL语句:取出数字符合要求的数据
- 我思考了一天的sql语句,高手请看!
- SQLServer2005安装时出错,请指点
- 紧急求援--如何求在一张表中,具有相同字段a的值的所有记录的b字段的和
- 请教一个存储过程的写法
- 如保将查询分析器中的查询结果分文件分工作表导出到xls中
- 100分招募Sql高手
- 下表筛选并增加几个字段?
- 怎样将表格中的某一列提取出来并且数据项不重复?
- declare a @Text as Text,how to Use ReadText Read TextType into @Text & Return
select a
go top
do while !eof()
select b
locate for allt(gsjb0001)==allt(a.gsjb0001) &&有索引用seek
if found()
update gkzx set gsjb0041=a.gsjb0041 where gsjb0001=a.gsjb0041 overwrite
endif
select a
skip
enddo
select a
use lsygnew
count to n &&这时表lsygnew已到文件尾了所以在下面加上一句
go top
select b
use gkzx
for i=1 to n
select a
dm=gsjb0001
select b
locate for gsjb0001=dm
if found()
update gkzx set gsjb0041=a.gsjb0041 where gsjb0001=dm overwrite
else
endif
go top
select a
if !eof()
skip
else
exit
endif
endfor