日期:2014-05-16  浏览次数:20633 次

计算访问量累加
新手问题,每天访问量累加  
          ID                                当天访问量PV           历史总量PVS
            1                                       10                               10
             2                                      8                                  18
            3                                       12                                30
      ...............................
怎么求这个总量PVS,然后把这个存进另一张大总表的字段中


------解决方案--------------------
select id,pv,(select sum(pv) from 表 where id<=a.id) pvs
from 表 a
order by id