每一个 SELECT ...SQL要扫描一次,加上循环调用就更慢。
试算了一下ywpjf和sxpjf(其他加上去就是),剩下是算名次。
程序代码:
CREATE CURSOR pjf (dsdm n(6),xqdm n(8),xxdm n(10),ckzrs I,;
ywpjf n(12,2),ywlkpx n(12,2),ywbspx n(12,2),ywbxpx n(12,2),;
sxpjf n(12,2),sxlkpx n(12,2),sxbspx n(12,2),sxbxpx n(12,2);
)
SELECT DISTINCT dsdm FROM cj ORDER BY dsdm INTO CURSOR tmp_dsdm
SELECT * FROM pjf WHERE .t. INTO CURSOR pjf_dsdm READWRITE
APPEND FROM DBF("tmp_dsdm")
INDEX on dsdm TAG tag_dsdm
SELECT DISTINCT xqdm FROM cj ORDER BY xqdm INTO CURSOR tmp_xqdm
SELECT * FROM pjf WHERE .t. INTO CURSOR pjf_xqdm READWRITE
APPEND FROM DBF("tmp_xqdm")
INDEX on xqdm TAG tag_xqdm
SELECT DISTINCT xxdm FROM cj ORDER BY xxdm INTO CURSOR tmp_xxdm
SELECT * FROM pjf WHERE .t. INTO CURSOR pjf_xxdm READWRITE
APPEND FROM DBF("tmp_xxdm")
INDEX on xxdm TAG tag_xxdm
INSERT INTO pjf (dsdm,ckzrs) VALUES (0,RECCOUNT("cj"))
SELECT cj
SET RELATION TO dsdm INTO "pjf_dsdm", xqdm INTO "pjf_xqdm", xxdm INTO "pjf_xxdm"
REPLACE ALL pjf.ywpjf WITH pjf.ywpjf + cj.yw,;
pjf.sxpjf WITH pjf.sxpjf + cj.sx,;
pjf_dsdm.ckzrs WITH pjf_dsdm.ckzrs + 1,;
pjf_dsdm.ywpjf WITH pjf_dsdm.ywpjf + cj.yw,;
pjf_dsdm.sxpjf WITH pjf_dsdm.sxpjf + cj.sx,;
pjf_xqdm.ckzrs WITH pjf_xqdm.ckzrs + 1,;
pjf_xqdm.ywpjf WITH pjf_xqdm.ywpjf + cj.yw,;
pjf_xqdm.sxpjf WITH pjf_xqdm.sxpjf + cj.sx,;
pjf_xxdm.ckzrs WITH pjf_xxdm.ckzrs + 1,;
pjf_xxdm.ywpjf WITH pjf_xxdm.ywpjf + cj.yw,;
pjf_xxdm.sxpjf WITH pjf_xxdm.sxpjf + cj.sx
SELECT pjf
APPEND FROM DBF("pjf_dsdm")
APPEND FROM DBF("pjf_xqdm")
APPEND FROM DBF("pjf_xxdm")
REPLACE ALL ywpjf WITH ywpjf/ckzrs,;
sxpjf WITH sxpjf/ckzrs
SELECT * FROM pjf
[此贴子已经被作者于2023-8-13 15:21编辑过]