优秀人数和优秀率不太对吗?你上传一个比较全的(有6门成绩在A等的学生人数)样本数据表,我再试试看。
民工子弟学校22班团小组长阳光模特队长冲锋篮球队前锋小苹果合唱队领唱蓝天舞蹈队编舞
CLOSE DATABASES ALL USE dj lcstr="" FOR i=3 TO FCOUNT()-2 lcstr=lcstr+"+"+FIELD(i) ENDFOR lcstr=SUBSTR(lcstr,1) SELECT DW,IIF(OCCURS("D",&lcstr)=0,1,0) AS 合格,IIF(OCCURS("A",&lcstr)>=6 AND OCCURS("D",&lcstr)=0,1,0) AS 优秀 FROM DJ INTO CURSOR CX SELECT DW,COUNT(*) DW人数,SUM(合格) 合格人数,SUM(合格)*100/COUNT(*) AS 合格率,SUM(优秀) AS 优秀人数,SUM(优秀)*100/COUNT(*) AS 优秀率 FROM CX GROUP BY DW
[此贴子已经被作者于2016-8-9 14:33编辑过]