趁与下属部门校对数据的间隙,做了前200的分配,仅供参考
*******************
* 名称:最优200名分配录取
*
* 时间:2024-12-11
*******************
CLEAR ALL
SET ENGINEBEHAVIOR 70
SET SAFETY OFF
SET DELETED on
PUBLIC mypath
cCurrentProcedure = SYS(16,1)
nPathStart = AT(":",cCurrentProcedure)- 1
nLenOfPath = RAT("\", cCurrentProcedure) - (nPathStart)
mypath=SUBSTR(cCurrentProcedure, nPathStart, nLenofPath)
SET DEFAULT TO (mypath)
*---
SELECT SPACE(10) as sjs,* from bmk1 orde by zf desc,sx desc,yw desc,wy desc top 200 into table bmkls
&& 提取前200名学生。此句的orde by 子句中,可加入等级内容 加上WHERE 过滤评价不符
RAND(SECONDS())
&&&& 根据时间秒数的不一,来产生随机数,保证每次启动都不一样
SELECT bmkls
REPLACE sjs with ALLTRIM(STR((RAND()*987651327))) all
SELECT * from bmkls orde by sjs into cursor temp readw
&& 按随机数排序
SELECT temp
REPLACE lqxxdm with [A501] for RECNO()<=50
REPLACE lqxxdm with [A502] for RECNO()>50 and RECNO()<=100
REPLACE lqxxdm with [A503] for RECNO()>100 and RECNO()<=150
REPLACE lqxxdm with [A504] for RECNO()>150
*---分配结束
GO top
SCAN
SELECT bmkls
LOCATE for bmkls.xsdm=temp.xsdm
IF FOUND()
REPLACE bmkls.lqxxdm with temp.lqxxdm
ENDIF
SELECT temp
ENDSCAN
*---分配结果写入
CLOSE DATABASES
SELECT [
] as 抽签学校,lqxxdm,sum(zf) as zf,coun(*) as rs ,sum(zf)/coun(*) as pjf,sum(IIF([女]$xb,1,0)) as nsrs,;
sum(IIF(zf>=670,1,0)) as fsd670,sum(IIF(zf>=660 and zf<670,1,0)) as fsd660,;
sum(IIF(zf>=650 and zf<660,1,0)) as fsd650,sum(IIF(zf>=640 and zf<650,1,0)) as fsd640 ;
from bmkls grou by lqxxdm into table q200fptj
SELECT q200fptj
BROWSE
&& 观察结果,浏览尚未满意,就重新运算,
*---分配统计,观察满意后结束。并组织校长进行抽签
[此贴子已经被作者于2024-12-11 09:24编辑过]