终于又回来了
【独叶为舟】工作室
CLOSE ALL USE zkjhk COPY TO ARRAY laArr FIELDS zsrs USE bmk.dbf RAND(SECONDS()) STORE 0 TO lnCnt1,lnCnt2,lnCnt3,lnCnt4 SCAN lnRound=RAND() DO CASE CASE lnRound<=laArr(1)/(laArr(1)+laArr(2)+laArr(3)+laArr(4)) AND lnCnt1<laArr(1) lcSchool='0100' lnCnt1=lnCnt1+1 CASE lnRound<=(laArr(1)+laArr(2))/(laArr(1)+laArr(2)+laArr(3)+laArr(4)) AND lnCnt2<laArr(2) lcSchool='0200' lnCnt2=lnCnt2+1 CASE lnRound<=(laArr(1)+laArr(2)+laArr(3))/(laArr(1)+laArr(2)+laArr(3)+laArr(4)) AND lnCnt3<laArr(3) lcSchool='0300' lnCnt3=lnCnt3+1 OTHERWISE lcSchool='0400' lnCnt4=lnCnt4+1 ENDCASE REPLACE lqxxdm WITH lcSchool ENDSCAN SELECT lqxxdm,CNT(*) cnttot,AVG(tot) avgtot FROM bmk GROUP BY lqxxdm