标题:求助:多条件记录替换
只看楼主
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:20 
SELECT *, 0 bl FROM "tb - 副本.dbf" INTO CURSOR tmp READWRITE
SELECT tmp
GO TOP
DO WHILE !EOF()
    IF (a != 0) AND (a != fqbz)
        nRecno = RECNO()
        SCATTER TO arr
        LOCATE FOR fqbz==arr[4] AND zcj==arr[2] AND a==0 AND bl==0
        IF FOUND()
            REPLACE fqbz WITH arr[3], bl WITH 1
            GO nRecno
            REPLACE fqbz WITH arr[4]
        ELSE
            GO nRecno
        ENDIF
    ENDIF
    SKIP
ENDDO
GO TOP
BROWSE FOR (a != 0) AND (a != fqbz)
2017-08-01 14:48
chychychy
Rank: 2
等 级:论坛游民
帖 子:126
专家分:18
注 册:2015-4-18
得分:0 
回复 21楼 吹水佬
牛,谢谢!仿照你的,我把他放在一个数据库中执行,你的 do  和  if   语句,完整实现要求。学了!
GO TOP
DO WHILE !EOF()
    IF (a != 0) AND (a != fqbz)
        nRecno = RECNO()
        SCATTER TO arr
        LOCATE FOR fqbz==arr[4] AND zcj==arr[2] AND a==0 and bz==0
        IF FOUND()
            REPLACE fqbz WITH arr[3],bz with 1
            GO nRecno
            REPLACE fqbz WITH arr[4]
        ELSE
            GO nRecno
        ENDIF
    ENDIF
    SKIP
ENDDO
GO TOP
BROWSE FOR (a != 0) AND (a != fqbz)
2017-08-01 15:42



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-479729-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.111929 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved