如何统计各学科人数?
如何统计jsrkb.dbf中各学科的人数(其中姓名有重复),望高手赐教,万分感谢!!!
统计各学科人数.rar
(1.35 KB)
CLOSE DATABASES USE jsrkb BLANK FOR RECNO() = RECCOUNT() FOR i = 3 TO FCOUNT() INDEX on EVALUATE(FIELD(i)) TO aa UNIQUE FOR NOT EMPTY(EVALUATE(FIELD(i))) COUNT TO hj SET ORDER TO REPLACE RECORD RECCOUNT() (FIELD(i)) WITH TRANSFORM(hj), nj WITH "合计" ENDFOR BROWSE USE ERASE aa.idx
[此贴子已经被作者于2020-4-7 10:10编辑过]
SET SAFETY OFF SET ENGINEBEHAVIOR 70 CREATE TABLE xkrstj (xkmc c(10),rs n(3)) CLOSE DATABASES SELECT 0 USE xkrstj ALIAS tj SELECT 0 USE jsrkb ALIAS kb FOR i=3 TO FCOUNT() zdm=FIELD(i) SELECT EVALUATE(zdm) as kg FROM kb INTO TABLE tmp SELECT tmp SELECT kg FROM tmp WHERE !EMPTY(kg) GROUP BY kg INTO CURSOR ttt SELECT ttt nn=RECCOUNT() SELECT tj APPEND BLANK REPLACE xkmc WITH zdm,rs WITH nn SELECT ttt USE SELECT tmp USE SELECT kb ENDFOR SELECT tj BROWSE