注册 登录
编程论坛 VFP论坛

统计结果不再放到 B6里怎么办

yd1954 发布于 5 天前 21:44, 70 次点击
schtg 老师你好。你对我在6月11日的帮助请求给了下面的代码。
现在我想将这段代码的统计结果放到B5的h120g,h120c字段里,不放到B6里。应该怎么改?我不会,请老师帮助。
B5被我改来改去,其中的字段与6月的不同。

select distinct h12_0 as hz1g,min(xh) as zxh,000000 as hz1c from b5 group by h12_0 order by zxh into cursor t1 readwrite
select h12_0,count(*) as zcs from b5 group by h12_0 into cursor t2
update t1 set t1.h120c = t2.zcs from t1,t2 where t1.h120g = t2.hz_1b
select h120g,h120c from t1 where h120c > 0 order by zxh into table B6

只有本站会员才能查看附件,请 登录
2 回复
#2
schtg4 天前 07:10
直接在后面加上一些判断代码和赋值代码即可,请试一试哈。
程序代码:
select distinct h12_0 as hz1g,min(xh) as zxh,000000 as hz1c from b5 group by h12_0 order by zxh into cursor t1 readwrite
select h12_0,count(*) as zcs from b5 group by h12_0 into cursor t2
update t1 set t1.h120c = t2.zcs from t1,t2 where t1.h120g = t2.h12_0
select h120g,h120c from t1 where h120c > 0 order by zxh into table B6

SELECT B5
IF Fsize("h120c") > 0
else
   alter table B5 add h120c n(7,0)
endif
update B5 set B5.h120c = B6.hz1c from B5,B6 where B5.hz_1b = B6.hz1g
#3
yd19543 天前 16:21
回复 2楼 schtg
非常感谢老师的帮助。程序运行了几次也没行。不知道什么原因。先把账结了。隔一段时间再说。
1