如何编程统计出各班人数,男女生数
不用输入班级号subs(lyxh,5,3)就能快速从a表统计出各班人数zs,男生数nl女生数ls
人数统计.rar
(13.27 KB)
到b表[此贴子已经被作者于2016-12-8 15:05编辑过]
SELECT SUBSTR(lyxh,5,3) as bj,xm,xb FROM a INTO CURSOR tmp1 **把班级数据存入临时表tmp1 SELECT bj,coun(bj) as zs,sum(iif(xb='男',1,0)) as ns,sum(iif(xb='女',1,0)) as ls FROM tmp1 GROUP BY bj ORDER BY bj INTO ARRAY tmp2 **把统计数据存入数组tmp2 INSERT INTO b FROM ARRAY tmp2 **把统计的数组数据写入B表中
[此贴子已经被作者于2016-12-12 17:30编辑过]
[此贴子已经被作者于2016-12-13 09:57编辑过]