如何按kc字段判断生成新字段cc,并在新字段中填入场别
kc.rar
(328 Bytes)
001-042 第一场
043-084 第二场
085-118 第三场
119-160 第四场
161-202 第五场
203-244 第六场
245-278 第七场
按照这样在001-042考场后边列增加cc字段并填入第一场,以此类推,求大师帮忙
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
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编辑过]