回复 10楼 aaaaaa
看8楼的意思,就是这样。[此贴子已经被作者于2016-7-8 08:36编辑过]
[此贴子已经被作者于2016-7-8 08:36编辑过]
2016-07-08 08:35
2016-07-08 09:01

2016-07-08 09:20
[此贴子已经被作者于2016-7-8 10:10编辑过]
2016-07-08 10:00
[此贴子已经被作者于2016-7-8 10:21编辑过]
2016-07-08 10:17
程序代码:close databases all
select min(总分) df, max(总分) gf from cj into array fs
select distinct 学校 from cj into cursor xxmc
ndf=fs[1,1]
ngf=fs[1,2]
fsd=16 && 此处分数段可以随意更改
zds=ceiling(ngf/fsd) && 可设置的字段数
messagebox("当前字段数:"+transform(zds))
if zds>254
return
endif
* 创建分数段表
create cursor fsd (n n(4), f1 n(3),f2 n(3))
f11=0
lcstr=""
for i=1 to zds
insert into fsd values (i,f11,fsd*i)
lcstr=lcstr+"F"+padl(f11,3,"0")+"_"+padl(i*fsd,3,"0")+" N(6),"
f11=fsd*i+1
endfor
lcstr=left(lcstr,len(lcstr)-1)
* 创建统计表
create cursor tjb (学校 c(6),&lcstr)
append from dbf("xxmc")
index on 学校 tag xx
select 学校,总分,n,f1,f2 from cj,fsd where between(总分,f1,f2) into cursor temp
select temp
set relation to 学校 into tjb
scan
replace ("F"+padl(temp.f1,3,"0")+"_"+padl(temp.f2,3,"0")) with evaluate("F"+padl(temp.f1,3,"0")+"_"+padl(temp.f2,3,"0"))+1 in tjb
endscan
set relation to
select tjb
set order to
* 列小计
insert into tjb (学校) values ("小计")
for i=2 to fcount()
czdm=field(i)
sum evaluate(field(i)) to x
replace record reccount() (field(i)) with x
endfor
* 行合计
alter table tjb add 合计 n(6)
hj=""
for i=2 to fcount()-1
hj=hj+"+"+(field(i))
endfor
replace all 合计 with evaluate(hj)
* 浏览统计结果
browse[此贴子已经被作者于2016-7-10 10:35编辑过]

2016-07-08 13:58
2016-07-09 09:05
2016-07-09 09:21
2016-07-10 10:34