主题:统计代码问题
笨兔
[专家分:300] 发布于 2008-07-23 16:41:00
FOR i=1 TO 12
SELECT curFinance
APPEND BLANK
REPLACE nMonth WITH i
SELECT SUM (bepay) FROM curinmaster WHERE nmonth=i INTO ARRAY a
SELECT SUM (unpay) FROM curinmaster WHERE nmonth=i INTO ARRAY b
REPLACE SumIn WITH a+b;
BePay WITH a,UnPay WITH b
endfor
回复列表 (共3个回复)
沙发
cbl518 [专家分:57140] 发布于 2008-07-23 20:08:00
你的最后语句缺少 ,号
FOR i=1 TO 12
SELECT curFinance
APPEND BLANK
REPLACE nMonth WITH i
SELECT SUM (bepay) FROM curinmaster WHERE nmonth=i INTO ARRAY a
SELECT SUM (unpay) FROM curinmaster WHERE nmonth=i INTO ARRAY b
REPLACE SumIn WITH a+b,BePay WITH a,UnPay WITH b
ENDFOR
板凳
cbl518 [专家分:57140] 发布于 2008-07-23 20:24:00
你的语句结构不合理:
SELECT curFinance
FOR i=1 TO 12
SELECT SUM (bepay),SUM (unpay) FROM curinmaster WHERE nmonth=i INTO ARRAY a0
INSERT INTO curFinance(nMonth,SumIn,BePay,UnPay) VALUES (i,a0[i,1]+a0[i,2],a0[i,1],a0[i,2])
ENDFOR
3 楼
cbl518 [专家分:57140] 发布于 2008-07-23 20:25:00
一条语句执行:
INSERT INTO curFinance (nMonth,SumIn,BePay,UnPay) ;
SELECT nmonth,SUM (bepay)+SUM (unpay),SUM (bepay),SUM (unpay) FROM curFinance ;
GROUP BY 1 WHERE nmonth < 13
我来回复