sql="select * from from table where data<>data" 打开 while not rs.eof sql="select data_infocount=data_info+data_info from table where data=data " rs1.open sql,O_con,1,1 data_info=rs(data_infocount) rs1.close rs.movenext wend rs.close
to feiye你这样子应该是把所有记录的总额算出来了吧?我只要每天的总额。
可以在sql语句后面加条件吧! where date='今天'; 你也可以考虑用临时表,先把今天所有的记录倒入临时表,再对临时表进行总额处理呀!
打开
while not rs.eof sql="select data_infocount=data_info+data_info from table where data=data "
rs1.open sql,O_con,1,1
data_info=rs(data_infocount)
rs1.close
rs.movenext
wend
rs.close
where date='今天';
你也可以考虑用临时表,先把今天所有的记录倒入临时表,再对临时表进行总额处理呀!
这样就是统计每天的总额。
比如你的例子,结果就是:
date sum_info
1, 2002-2-1 800
2, 2002-2-3 100
3, 2002-2-5 233