如何将每个学科任课老师一一列举出来(重复的只算一次)
现有任课教师表文件jsrkb20180920.dbf,如何将每个学科任课教师一一列举出来,重复的只算一次,例如英语学科只有10位老师任教,就将10位老师列出来…,并保存到表文件中。请高手帮忙,万分感谢!!!
jsrkb20180920.rar
(1.38 KB)
[此贴子已经被作者于2020-4-16 14:26编辑过]
CLOSE DATABASES CREATE CURSOR jskb (jsxm c(8), km c(10)) USE jsrkb IN 0 SELECT jsrkb SCAN FOR i = 3 TO FCOUNT() ckc = FIELD(i) IF NOT EMPTY(EVALUATE("jsrkb." + ckc)) INSERT INTO jskb VALUES (EVALUATE("jsrkb." + ckc), ckc) ENDIF ENDFOR ENDSCAN SELECT DISTINCT km, COUNT(*) rs FROM jskb GROUP BY km INTO CURSOR km CALCULATE MAX(rs) TO nrs cStr = "" SCAN cStr = cStr + ALLTRIM(km) + " C(10), " ENDSCAN cStr = LEFT(cStr, LEN(cStr) - 2) CREATE CURSOR jsmd (&cStr) FOR i = 1 TO nrs APPEND BLANK ENDFOR SELECT km SCAN SELECT DISTINCT jsxm FROM jskb WHERE ALLTRIM(km) == ALLTRIM(km.km) INTO ARRAY amd REPLACE FROM ARRAY amd FIELDS (km.km) ALL IN jsmd ENDSCAN SELECT jsmd BROWSE