select sum(销售字段) as sum from table

解决方案 »

  1.   

    如果你只需要特定月的统计的话:
    select sum(销售字段) as MonthSum from tablename where year(你的日期字段)=2001 and month(你的日期字段)=1 (返回2001.1的总计)如果你想显示每个月的统计的话:
    select year(你的日期字段),month(你的日期字段),sum(销售字段) from tablename
    group by year(你的日期字段),month(你的日期字段)
    order by year(你的日期字段),month(你的日期字段)
      

  2.   

    '跨年的时候自己判断一下
    Dim strBegin As String
    Dim strEnd As String
    Dim strSQL As StringstrBegin = Year(Date) & "-" & Month(Date) & "-1"
    strEnd = Year(Date) & "-" & (Month(Date) + 1) & "-1"strSQL = "select sum(每天销售记录值) as 每月月底统计总和 from table where 日期 >=#" & strbeging & "# and  日期 <#" & strEnd & "#"
      

  3.   

    吴文智)兄
    你的strSQL = "select sum(每天销售记录值) as 每月月底统计总和 from table where 日期 >=#" & strbeging & "# and  日期 <#" & strEnd & "#"
    只能显示日期不能统计记录