2楼的好方法,也可以试一试哈
程序代码:
select *,space(12) as cc from kc into cursor tt readwrite
select tt
replace cc with "第一场" for val(kc) >= 1 and val(kc) <= 42
replace cc with "第二场" for val(kc) >= 43 and val(kc) <= 84
replace cc with "第三场" for val(kc) >= 85 and val(kc) <= 118
replace cc with "第四场" for val(kc) >= 119 and val(kc) <= 160
replace cc with "第五场" for val(kc) >= 161 and val(kc) <= 202
replace cc with "第六场" for val(kc) >= 203 and val(kc) <= 244
replace cc with "第七场" for val(kc) >= 245 and val(kc) <= 278
go top
browse
还有这种考场分布规律性不强的,可以单列一个考场分配表(_ls),然后试一试下面的方法:
程序代码:
set safety off
close all
create dbf _ls(kc1 c(5),kc2 c(5),kcm c(12))
insert into _ls(kc1,kc2,kcm) values("001","042","第一考场")
insert into _ls(kc1,kc2,kcm) values("043","084","第二考场")
insert into _ls(kc1,kc2,kcm) values("085","118","第三考场")
insert into _ls(kc1,kc2,kcm) values("119","160","第四考场")
insert into _ls(kc1,kc2,kcm) values("161","202","第五考场")
insert into _ls(kc1,kc2,kcm) values("203","244","第六考场")
insert into _ls(kc1,kc2,kcm) values("245","278","第七考场")
select *,space(12) as cc from kc into table tt
select _ls
go top
scan
kcs1 = kc1
kcs2 = kc2
kcmc = kcm
update tt set cc = alltrim(kcmc) where kc >= kcs1 and kc <= kcs2
endscan
select tt
go top
browse
[此贴子已经被作者于2024-5-19 06:31编辑过]