CREATE CURSOR curTmp (日期 c(8),报价 i,最高价 i,最低价 i,成交价 i,成交量 n(10,2),成交额 n(10,2))
INSERT INTO curTmp VALUES ('20181101',100,100,98,99,10,990)
INSERT INTO curTmp VALUES ('20181102',99,99,97,98,15,1470)
INSERT INTO curTmp VALUES ('20181103',98,101,100,100,9,900)
INSERT INTO curTmp VALUES ('20181104',101,102,100,101,12,1212)
GO TOP
DO WHILE !EOF()
SCATTER BLANK NAME oRec
oRec.报价 = 报价
oRec.最低价 = 最低价
i = 0
DO WHILE i < 4 AND !EOF()
IF oRec.最高价 < 最高价
oRec.最高价 = 最高价
ENDIF
IF oRec.最低价 > 最低价
oRec.最低价 = 最低价
ENDIF
oRec.成交价 = 成交价
oRec.成交量 = oRec.成交量 + 成交量
oRec.成交额 = oRec.成交额 + 成交额
i = i + 1
SKIP
ENDDO
oRec.成交量 = ROUND(oRec.成交量/i,2)
oRec.成交额 = ROUND(oRec.成交额/i,2)
INSERT blan before
GATHER NAME oRec
SKIP
ENDDO
BROWSE