回复 9楼 wengjl
如果成绩不是整数,加个中间临时表(lsk),楼主提出问题时我也考虑到会不会有这个状态:
SELECT INT(zcj) AS zcj FROM cjk WHERE BETWEEN(zcj,0,650) INTO CURSOR lsk
SELECT zcj,COUNT(zcj) FROM lsk GROUP BY zcj INTO TABLE tjk
再,如果要以5分为区段统计的话,加临时表(lsk)和临时字段(lszd):
SELECT INT(zcj/5) AS lszd,zcj FROM v_sgxt WHERE BETWEEN(zcj,0,650) INTO CURSOR lsk
SELECT STR(lszd*5)+'-'+LTRIM(STR((lszd+1)*5-1)),COUNT(zcj) FROM lsk GROUP BY lszd INTO TABLE tjk