再请教考场编排的问题
现有一学校报名数据bmk(bmh 报名号,kldm 科类代码,njdm 年级代码,kch 考场号,zwh 座位号),共有三个年级,每个年级有文科(11)和理科(12),如何编程安排考场(30人一个考场)?在论坛中学习了老师们编排考场的程序,每次都分年级分科类编排考场后再把数据合拢,很麻烦!现在想请教老师们帮忙支招!不胜感激!
bmk.rar
(1.31 KB)
SELECT distinct njdm,kldm FROM bmk INTO CURSOR t SCAN SELECT bmh,njdm,kldm,SPACE(2) 考场号,SPACE(2) 座位号 FROM bmk WHERE njdm==t.njdm AND kldm==t.kldm INTO CURSOR T1 READWRITE REPLACE ALL 考场号 WITH TRANSFORM(CEILING(RECNO()/30)),座位号 WITH TRANSFORM(IIF(MOD(RECNO(),30)=0,30,MOD(RECNO(),30))) UPDATE BMK SET KCH=考场号,ZWH=座位号 FROM T1 WHERE BMK.BMH=T1.BMH ENDSCAN SELECT BMK BROWSE是否是楼主所要的结果
*--如果全校考场编号是统一的,代码如下: SELECT NJDM,KLDM FROM BMK GROUP BY 1,2 INTO CURSOR T ZKCH=0 &&记录总考场号 SCAN SELECT BMH,NJDM,KLDM,SPACE(2) 考场号,SPACE(2) 座位号 FROM BMK WHERE NJDM==T.NJDM AND KLDM==T.KLDM INTO CURSOR T1 READWRITE REPLACE ALL 考场号 WITH TRANSFORM(CEILING(RECNO()/30)+ZKCH),座位号 WITH TRANSFORM(IIF(MOD(RECNO(),30)=0,30,MOD(RECNO(),30))) GO BOTTOM IN T1 ZKCH=VAL(考场号) UPDATE BMK SET KCH=考场号,ZWH=座位号 FROM T1 WHERE BMK.BMH=T1.BMH ENDSCAN SELECT BMK BROWSE