回复 9楼 shyibaoban
主要是这里:SELECT ry
GO top
rynl=VAL(nl) && 你这里的rynl 没有参加循环
DO WHILE .t.
IF EOF()
EXIT
ENDIF
IF rynl>=60 AND xb="男" AND xzdm!="d" AND xzdm!="e"
replace xzdm WITH "b",ryxz WITH "老年居民"
ENDIF
IF rynl>=55 AND xb="女" AND xzdm!="d" AND xzdm!="e"
replace xzdm WITH "b",ryxz WITH "老年居民"
ENDIF
IF rynl<18 AND xzdm!="d" AND xzdm!="e" AND xzdm!="f"
replace xzdm WITH "a",ryxz with "儿童及18周岁以下居民"
ENDIF
IF rynl>=18 AND rynl<60 AND xb="男" AND xzdm!="d" AND xzdm!="e" AND xzdm!="f"
replace xzdm WITH "c",ryxz with "其他非从业居民"
ENDIF
IF rynl>=18 AND rynl<55 AND xb="女" AND xzdm!="d" AND xzdm!="e" AND xzdm!="f"
replace xzdm WITH "c",ryxz WITH "其他非从业居民"
ENDIF
skip
ENDDO
比如女55以上为老年居民。但更新完后人员性质和代码没变。
---------------------------------
可改成(不要用do循环,否则当记录超过几十万时,速度很慢的):
SELECT ry
replace xzdm WITH "b",ryxz WITH "老年居民" for VAL(nl)>=60 AND xb="男" AND xzdm!="d" AND xzdm!="e"
replace xzdm WITH "b",ryxz WITH "老年居民" for VAL(nl)>=55 AND xb="女" AND xzdm!="d" AND xzdm!="e"
replace xzdm WITH "a",ryxz with "儿童及18周岁以下居民" for VAL(nl)<18 AND xzdm!="d" AND xzdm!="e" AND xzdm!="f"
....
[ 本帖最后由 茵梦湖 于 2010-1-3 18:50 编辑 ]