回复 8楼 tlliqi
写了这个循环语句,结果是出来了,但是不知道怎么能在CY1里标记
sele 1
use cy1.dbf
sele 2
use yb.dbf
sele 3
use wx.dbf
SELECT 4
USE cy2.dbf
SELECT 4
DELETE ALL
PACK
for i=53 to 89
for m=1 to 5
sele 2
sele * from yb where hydl=i and fc=m into dbf ls1
SELECT ls1
n=RECCOUNT()
k=n+5
SELECT 1
SELECT * FROM cy1 WHERE hydl=i AND fc=m INTO dbf ls2
SELECT ls2
s=RECCOUNT()
IF k<=s
SELECT 3
SELECT * FROM wx WHERE hydl=i AND fc=m INTO dbf ls3
SELECT ls3
x=RECCOUNT()
IF x<>0
SELECT top x * FROM cy1 ORDER BY random WHERE hydl=i AND fc=m INTO dbf ls4
SELECT 4
APPEND FROM ls4
SELECT ls4
USE
DELETE FILE ls4.dbf
ENDIF
SELECT ls3
USE
DELETE FILE ls3.dbf
ENDIF
SELECT ls1
USE
DELETE FILE ls1.dbf
SELECT ls2
USE
DELETE FILE ls2.dbf
ENDFOR
ENDFOR
CLOSE ALL