回复 6楼 sdta
主要研究一下算法哈,确实数据量偏少。
回复 7楼 吹水佬
请问如何优化结构,使之更合理?谢谢!
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
[此贴子已经被作者于2023-3-19 22:36编辑过]