回复 20楼 sdta
@sdta,非常感谢!通过分段人数和累计人数确定排名,这就很快的,谢谢!
以下是引用sdta在2023-3-19 22:34:07的发言:
CLOSE DATABASES
SET COLLATE TO "MACHINE"
* 联考名次
SELECT * FROM xqpx ORDER BY xk, jf DESC INTO CURSOR temp READWRITE
BLANK FIELDS lkpx ALL
lcxk = SPACE(0) && 学科
lnjf = 0 && 均分
lnmc = 1 && 名次
lnrs = 0 && 记录全部同科人数
SCAN
lnrs = lnrs + 1
IF xk == lcxk
IF jf = lnjf
ELSE
lnmc = lnrs
ENDIF
ELSE
lnmc = 1
lnrs = 1
ENDIF
REPLACE lkpx WITH lnmc
lcxk = xk
lnjf = jf
lnmc = lkpx
ENDSCAN
* 同市同科名次
SELECT * FROM temp ORDER BY dsmc,xk, jf DESC INTO CURSOR temp READWRITE
BLANK FIELDS bspx ALL
lcxk = SPACE(0) && 学科
lnjf = 0 && 均分
lnmc = 1 && 名次
lnrs = 0 && 记录本市同科人数
lcbs = SPACE(0) && 地市名称
SCAN
lnrs = lnrs + 1
IF dsmc == lcbs AND xk == lcxk
IF jf = lnjf
ELSE
lnmc = lnrs
ENDIF
ELSE
lnmc = 1
lnrs = 1
ENDIF
REPLACE bspx WITH lnmc
lcxk = xk
lnjf = jf
lnmc = bspx
lcbs = dsmc
ENDSCAN
* 同县同科名次
SELECT * FROM temp ORDER BY xqmc,xk, jf DESC INTO CURSOR temp READWRITE
BLANK FIELDS bxpx ALL
lcxk = SPACE(0) && 学科
lnjf = 0 && 均分
lnmc = 1 && 名次
lnrs = 0 && 记录本县同科人数
lcbx = SPACE(0) && 县名称
SCAN
lnrs = lnrs + 1
IF xqmc == lcbx AND xk == lcxk
IF jf = lnjf
ELSE
lnmc = lnrs
ENDIF
ELSE
lnmc = 1
lnrs = 1
ENDIF
REPLACE bxpx WITH lnmc
lcxk = xk
lnjf = jf
lnmc = bxpx
lcbx = xqmc
ENDSCAN
BROWSE
CLOSE DATABASES
SET COLLATE TO "MACHINE"
* 联考名次
SELECT * FROM xqpx ORDER BY xk, jf DESC INTO CURSOR temp READWRITE
BLANK FIELDS lkpx ALL
lcxk = SPACE(0) && 学科
lnjf = 0 && 均分
lnmc = 1 && 名次
lnrs = 0 && 记录全部同科人数
SCAN
lnrs = lnrs + 1
IF xk == lcxk
IF jf = lnjf
ELSE
lnmc = lnrs
ENDIF
ELSE
lnmc = 1
lnrs = 1
ENDIF
REPLACE lkpx WITH lnmc
lcxk = xk
lnjf = jf
lnmc = lkpx
ENDSCAN
* 同市同科名次
SELECT * FROM temp ORDER BY dsmc,xk, jf DESC INTO CURSOR temp READWRITE
BLANK FIELDS bspx ALL
lcxk = SPACE(0) && 学科
lnjf = 0 && 均分
lnmc = 1 && 名次
lnrs = 0 && 记录本市同科人数
lcbs = SPACE(0) && 地市名称
SCAN
lnrs = lnrs + 1
IF dsmc == lcbs AND xk == lcxk
IF jf = lnjf
ELSE
lnmc = lnrs
ENDIF
ELSE
lnmc = 1
lnrs = 1
ENDIF
REPLACE bspx WITH lnmc
lcxk = xk
lnjf = jf
lnmc = bspx
lcbs = dsmc
ENDSCAN
* 同县同科名次
SELECT * FROM temp ORDER BY xqmc,xk, jf DESC INTO CURSOR temp READWRITE
BLANK FIELDS bxpx ALL
lcxk = SPACE(0) && 学科
lnjf = 0 && 均分
lnmc = 1 && 名次
lnrs = 0 && 记录本县同科人数
lcbx = SPACE(0) && 县名称
SCAN
lnrs = lnrs + 1
IF xqmc == lcbx AND xk == lcxk
IF jf = lnjf
ELSE
lnmc = lnrs
ENDIF
ELSE
lnmc = 1
lnrs = 1
ENDIF
REPLACE bxpx WITH lnmc
lcxk = xk
lnjf = jf
lnmc = bxpx
lcbx = xqmc
ENDSCAN
BROWSE
大佬电脑什么配置,这么快