SELECT DISTINCT classmc FROM STUDENTS INTO CURSOR BJMC
SCAN
SELECT * FROM STUDENTS WHERE ALLTRIM(classmc)==ALLTRIM(BJMC.classmc) INTO CURSOR BJ
IF _TALLY>0
COPY TO (ALLTRIM(TT.classmc)+[学生名单.XLS]) TYPE XLS
ENDIF
USE IN BJ
ENDSCAN
SELECT DISTINCT classmc FROM STUDENTS INTO CURSOR BJMC
SCAN SELECT * FROM STUDENTS WHERE ALLTRIM(classmc)==ALLTRIM(BJMC.classmc) INTO CURSOR BJ IF _TALLY>0 COPY TO (ALLTRIM(BJ.classmc)+[学生名单.XLS]) TYPE XLS ENDIF USE IN BJ
ENDSCAN
求解释:
(1)ALLTRIM(classmc)==ALLTRIM(BJMC.classmc)为什么用==
(2)_TALLY>0是什么意思,主要是_TALLY代表什么
(3)USE IN BJ
没有数据,只凭大脑空转的代码段如下:
SET SAFETY OFF
SELECT COUNT(DISTINCT ClassID) FROM E:\db\Students INTO ARRAY ClassNO&&先确定有几个班
SELECT DISTINCT ClassID FROM E:\db\Students INTO ARRAY Classes&&再取出所有班级号
FOR I=1 TO ClassNO(1,1) SELECT * FROM E:\db\Students WHERE ClassID=Classes(I,1) INTO CURSOR Temp &&逐个找出匹配的班级号所有记录 SELECT Temp ExcelFileName=ALLTRIM(ClassMC)+"学生名单.XLS" COPY TO (ExcelFileName) XLS
NEXT
SET SAFETY ON
RETURN